diff --git a/internal/ast/parseoptions.go b/internal/ast/parseoptions.go index 465728e64a..f464a4523d 100644 --- a/internal/ast/parseoptions.go +++ b/internal/ast/parseoptions.go @@ -104,13 +104,19 @@ func getExternalModuleIndicator(file *SourceFile, opts ExternalModuleIndicatorOp func isFileProbablyExternalModule(sourceFile *SourceFile) *Node { for _, statement := range sourceFile.Statements.Nodes { - if IsExternalModuleIndicator(statement) { + if isAnExternalModuleIndicatorNode(statement) { return statement } } return getImportMetaIfNecessary(sourceFile) } +func isAnExternalModuleIndicatorNode(node *Node) bool { + return HasSyntacticModifier(node, ModifierFlagsExport) || + IsImportEqualsDeclaration(node) && IsExternalModuleReference(node.AsImportEqualsDeclaration().ModuleReference) || + IsImportDeclaration(node) || IsExportAssignment(node) || IsExportDeclaration(node) +} + func getImportMetaIfNecessary(sourceFile *SourceFile) *Node { if sourceFile.AsNode().Flags&NodeFlagsPossiblyContainsImportMeta != 0 { return findChildNode(sourceFile.AsNode(), IsImportMeta) diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index ea3fef8edc..c30a2fe0a9 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -1615,9 +1615,8 @@ func isCommonJSContainingModuleKind(kind core.ModuleKind) bool { } func IsExternalModuleIndicator(node *Statement) bool { - return HasSyntacticModifier(node, ModifierFlagsExport) || - IsImportEqualsDeclaration(node) && IsExternalModuleReference(node.AsImportEqualsDeclaration().ModuleReference) || - IsImportDeclaration(node) || IsExportAssignment(node) || IsExportDeclaration(node) + // Exported top-level member indicates moduleness + return IsAnyImportOrReExport(node) || IsExportAssignment(node) || HasSyntacticModifier(node, ModifierFlagsExport) } func IsExportNamespaceAsDefaultDeclaration(node *Node) bool { diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index 2a9b962262..1751edc63e 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -10,6 +10,7 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/diagnostics" "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/tspath" @@ -64,6 +65,10 @@ func processAllProgramFiles( compilerOptions := opts.Config.CompilerOptions() rootFiles := opts.Config.FileNames() supportedExtensions := tsoptions.GetSupportedExtensions(compilerOptions, nil /*extraFileExtensions*/) + var maxNodeModuleJsDepth int + if p := opts.Config.CompilerOptions().MaxNodeModuleJsDepth; p != nil { + maxNodeModuleJsDepth = *p + } loader := fileLoader{ opts: opts, defaultLibraryPath: tspath.GetNormalizedAbsolutePath(opts.Host.DefaultLibraryPath(), opts.Host.GetCurrentDirectory()), @@ -72,12 +77,11 @@ func processAllProgramFiles( CurrentDirectory: opts.Host.GetCurrentDirectory(), }, parseTasks: &fileLoaderWorker[*parseTask]{ - wg: core.NewWorkGroup(singleThreaded), - getSubTasks: getSubTasksOfParseTask, + wg: core.NewWorkGroup(singleThreaded), + maxDepth: maxNodeModuleJsDepth, }, projectReferenceParseTasks: &fileLoaderWorker[*projectReferenceParseTask]{ - wg: core.NewWorkGroup(singleThreaded), - getSubTasks: getSubTasksOfProjectReferenceParseTask, + wg: core.NewWorkGroup(singleThreaded), }, rootTasks: make([]*parseTask, 0, len(rootFiles)+len(libs)), supportedExtensions: core.Flatten(tsoptions.GetSupportedExtensionsWithJsonIfResolveJsonModule(compilerOptions, supportedExtensions)), @@ -289,22 +293,24 @@ func (p *fileLoader) parseSourceFile(t *parseTask) *ast.SourceFile { return sourceFile } -func (p *fileLoader) resolveTripleslashPathReference(moduleName string, containingFile string) string { +func (p *fileLoader) resolveTripleslashPathReference(moduleName string, containingFile string) resolvedRef { basePath := tspath.GetDirectoryPath(containingFile) referencedFileName := moduleName if !tspath.IsRootedDiskPath(moduleName) { referencedFileName = tspath.CombinePaths(basePath, moduleName) } - return tspath.NormalizePath(referencedFileName) + return resolvedRef{ + fileName: tspath.NormalizePath(referencedFileName), + } } func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta ast.SourceFileMetaData) ( - toParse []string, + toParse []resolvedRef, typeResolutionsInFile module.ModeAwareCache[*module.ResolvedTypeReferenceDirective], ) { if len(file.TypeReferenceDirectives) != 0 { - toParse = make([]string, 0, len(file.TypeReferenceDirectives)) + toParse = make([]resolvedRef, 0, len(file.TypeReferenceDirectives)) typeResolutionsInFile = make(module.ModeAwareCache[*module.ResolvedTypeReferenceDirective], len(file.TypeReferenceDirectives)) for _, ref := range file.TypeReferenceDirectives { redirect := p.projectReferenceFileMapper.getRedirectForResolution(file) @@ -312,7 +318,11 @@ func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta a resolved := p.resolver.ResolveTypeReferenceDirective(ref.FileName, file.FileName(), resolutionMode, redirect) typeResolutionsInFile[module.ModeAwareCacheKey{Name: ref.FileName, Mode: resolutionMode}] = resolved if resolved.IsResolved() { - toParse = append(toParse, resolved.ResolvedFileName) + toParse = append(toParse, resolvedRef{ + fileName: resolved.ResolvedFileName, + increaseDepth: resolved.IsExternalLibraryImport, + elideOnDepth: false, + }) } } } @@ -322,19 +332,12 @@ func (p *fileLoader) resolveTypeReferenceDirectives(file *ast.SourceFile, meta a const externalHelpersModuleNameText = "tslib" // TODO(jakebailey): dedupe func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, meta ast.SourceFileMetaData) ( - toParse []string, + toParse []resolvedRef, resolutionsInFile module.ModeAwareCache[*module.ResolvedModule], importHelpersImportSpecifier *ast.Node, jsxRuntimeImportSpecifier_ *jsxRuntimeImportSpecifier, ) { moduleNames := make([]*ast.Node, 0, len(file.Imports())+len(file.ModuleAugmentations)+2) - moduleNames = append(moduleNames, file.Imports()...) - for _, imp := range file.ModuleAugmentations { - if imp.Kind == ast.KindStringLiteral { - moduleNames = append(moduleNames, imp) - } - // Do nothing if it's an Identifier; we don't need to do module resolution for `declare global`. - } isJavaScriptFile := ast.IsSourceFileJS(file) isExternalModuleFile := ast.IsExternalModule(file) @@ -359,19 +362,39 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, } } + importsStart := len(moduleNames) + + moduleNames = append(moduleNames, file.Imports()...) + for _, imp := range file.ModuleAugmentations { + if imp.Kind == ast.KindStringLiteral { + moduleNames = append(moduleNames, imp) + } + // Do nothing if it's an Identifier; we don't need to do module resolution for `declare global`. + } + if len(moduleNames) != 0 { - toParse = make([]string, 0, len(moduleNames)) + toParse = make([]resolvedRef, 0, len(moduleNames)) + resolutionsInFile = make(module.ModeAwareCache[*module.ResolvedModule], len(moduleNames)) - resolutions := p.resolveModuleNames(moduleNames, file, meta, redirect) + for index, entry := range moduleNames { + moduleName := entry.Text() + if moduleName == "" { + continue + } - resolutionsInFile = make(module.ModeAwareCache[*module.ResolvedModule], len(resolutions)) + mode := getModeForUsageLocation(file.FileName(), meta, entry, module.GetCompilerOptionsWithRedirect(p.opts.Config.CompilerOptions(), redirect)) + resolvedModule := p.resolver.ResolveModuleName(moduleName, file.FileName(), mode, redirect) + resolutionsInFile[module.ModeAwareCacheKey{Name: moduleName, Mode: mode}] = resolvedModule - for _, resolution := range resolutions { - resolvedFileName := resolution.resolvedModule.ResolvedFileName - // TODO(ercornel): !!!: check if from node modules + if !resolvedModule.IsResolved() { + continue + } - mode := getModeForUsageLocation(file.FileName(), meta, resolution.node, optionsForFile) - resolutionsInFile[module.ModeAwareCacheKey{Name: resolution.node.Text(), Mode: mode}] = resolution.resolvedModule + resolvedFileName := resolvedModule.ResolvedFileName + isFromNodeModulesSearch := resolvedModule.IsExternalLibraryImport + // Don't treat redirected files as JS files. + isJsFile := !tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsWithJsonFlat) && p.projectReferenceFileMapper.getRedirectForResolution(ast.NewHasFileName(resolvedFileName, p.toPath(resolvedFileName))) == nil + isJsFileFromNodeModules := isFromNodeModulesSearch && isJsFile && strings.Contains(resolvedFileName, "/node_modules/") // add file to program only if: // - resolution was successful @@ -379,24 +402,20 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, // - module name comes from the list of imports // - it's not a top level JavaScript module that exceeded the search max - // const elideImport = isJSFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth; + importIndex := index - importsStart - // Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs') - // This may still end up being an untyped module -- the file won't be included but imports will be allowed. - hasAllowedExtension := false - if optionsForFile.GetResolveJsonModule() { - hasAllowedExtension = tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsWithJsonFlat) - } else if optionsForFile.AllowJs.IsTrue() { - hasAllowedExtension = tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedJSExtensionsFlat) || tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsFlat) - } else { - hasAllowedExtension = tspath.FileExtensionIsOneOf(resolvedFileName, tspath.SupportedTSExtensionsFlat) - } - shouldAddFile := resolution.resolvedModule.IsResolved() && hasAllowedExtension - // TODO(ercornel): !!!: other checks on whether or not to add the file + shouldAddFile := moduleName != "" && + getResolutionDiagnostic(optionsForFile, resolvedModule, file) == nil && + !optionsForFile.NoResolve.IsTrue() && + !(isJsFile && !optionsForFile.GetAllowJS()) && + (importIndex < 0 || (importIndex < len(file.Imports()) && (ast.IsInJSFile(file.Imports()[importIndex]) || file.Imports()[importIndex].Flags&ast.NodeFlagsJSDoc == 0))) if shouldAddFile { - // p.findSourceFile(resolvedFileName, FileIncludeReason{Import, 0}) - toParse = append(toParse, resolvedFileName) + toParse = append(toParse, resolvedRef{ + fileName: resolvedFileName, + increaseDepth: resolvedModule.IsExternalLibraryImport, + elideOnDepth: isJsFileFromNodeModules, + }) } } } @@ -404,6 +423,57 @@ func (p *fileLoader) resolveImportsAndModuleAugmentations(file *ast.SourceFile, return toParse, resolutionsInFile, importHelpersImportSpecifier, jsxRuntimeImportSpecifier_ } +// Returns a DiagnosticMessage if we won't include a resolved module due to its extension. +// The DiagnosticMessage's parameters are the imported module name, and the filename it resolved to. +// This returns a diagnostic even if the module will be an untyped module. +func getResolutionDiagnostic(options *core.CompilerOptions, resolvedModule *module.ResolvedModule, file *ast.SourceFile) *diagnostics.Message { + needJsx := func() *diagnostics.Message { + if options.Jsx != core.JsxEmitNone { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set + } + + needAllowJs := func() *diagnostics.Message { + if options.GetAllowJS() || !options.NoImplicitAny.DefaultIfUnknown(options.Strict).IsTrue() { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used + } + + needResolveJsonModule := func() *diagnostics.Message { + if options.GetResolveJsonModule() { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_resolveJsonModule_is_not_used + } + + needAllowArbitraryExtensions := func() *diagnostics.Message { + if file.IsDeclarationFile || options.AllowArbitraryExtensions.IsTrue() { + return nil + } + return diagnostics.Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set + } + + switch resolvedModule.Extension { + case tspath.ExtensionTs, tspath.ExtensionDts, + tspath.ExtensionMts, tspath.ExtensionDmts, + tspath.ExtensionCts, tspath.ExtensionDcts: + // These are always allowed. + return nil + case tspath.ExtensionTsx: + return needJsx() + case tspath.ExtensionJsx: + return core.Coalesce(needJsx(), needAllowJs()) + case tspath.ExtensionJs, tspath.ExtensionMjs, tspath.ExtensionCjs: + return needAllowJs() + case tspath.ExtensionJson: + return needResolveJsonModule() + default: + return needAllowArbitraryExtensions() + } +} + func (p *fileLoader) resolveModuleNames(entries []*ast.Node, file *ast.SourceFile, meta ast.SourceFileMetaData, redirect *tsoptions.ParsedCommandLine) []*resolution { if len(entries) == 0 { return nil diff --git a/internal/compiler/fileloadertask.go b/internal/compiler/fileloadertask.go index 9ad77d7f32..8dbf9ce76f 100644 --- a/internal/compiler/fileloadertask.go +++ b/internal/compiler/fileloadertask.go @@ -1,43 +1,75 @@ package compiler import ( + "math" + "sync" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/tspath" ) -type fileLoaderWorkerTask interface { +type fileLoaderWorkerTask[T any] interface { comparable FileName() string - start(loader *fileLoader) + isLoaded() bool + load(loader *fileLoader) + getSubTasks() []T + shouldIncreaseDepth() bool + shouldElideOnDepth() bool } -type fileLoaderWorker[K fileLoaderWorkerTask] struct { +type fileLoaderWorker[K fileLoaderWorkerTask[K]] struct { wg core.WorkGroup - tasksByFileName collections.SyncMap[string, K] - getSubTasks func(t K) []K + tasksByFileName collections.SyncMap[string, *queuedTask[K]] + maxDepth int +} + +type queuedTask[K fileLoaderWorkerTask[K]] struct { + task K + mu sync.Mutex + lowestDepth int } func (w *fileLoaderWorker[K]) runAndWait(loader *fileLoader, tasks []K) { - w.start(loader, tasks) + w.start(loader, tasks, 0) w.wg.RunAndWait() } -func (w *fileLoaderWorker[K]) start(loader *fileLoader, tasks []K) { - if len(tasks) > 0 { - for i, task := range tasks { - loadedTask, loaded := w.tasksByFileName.LoadOrStore(task.FileName(), task) - if loaded { - // dedup tasks to ensure correct file order, regardless of which task would be started first - tasks[i] = loadedTask - } else { - w.wg.Queue(func() { - task.start(loader) - subTasks := w.getSubTasks(task) - w.start(loader, subTasks) - }) - } +func (w *fileLoaderWorker[K]) start(loader *fileLoader, tasks []K, depth int) { + for i, task := range tasks { + newTask := &queuedTask[K]{task: task, lowestDepth: math.MaxInt} + loadedTask, loaded := w.tasksByFileName.LoadOrStore(task.FileName(), newTask) + task = loadedTask.task + if loaded { + tasks[i] = task + } + + currentDepth := depth + if task.shouldIncreaseDepth() { + currentDepth++ + } + + if task.shouldElideOnDepth() && currentDepth > w.maxDepth { + continue } + + w.wg.Queue(func() { + loadedTask.mu.Lock() + defer loadedTask.mu.Unlock() + + if !task.isLoaded() { + task.load(loader) + } + + if currentDepth < loadedTask.lowestDepth { + // If we're seeing this task at a lower depth than before, + // reprocess its subtasks to ensure they are loaded. + loadedTask.lowestDepth = currentDepth + subTasks := task.getSubTasks() + w.start(loader, subTasks, currentDepth) + } + }) } } @@ -49,12 +81,12 @@ func (w *fileLoaderWorker[K]) collectWorker(loader *fileLoader, tasks []K, itera var results []tspath.Path for _, task := range tasks { // ensure we only walk each task once - if seen.Has(task) { + if !task.isLoaded() || seen.Has(task) { continue } seen.Add(task) var subResults []tspath.Path - if subTasks := w.getSubTasks(task); len(subTasks) > 0 { + if subTasks := task.getSubTasks(); len(subTasks) > 0 { subResults = w.collectWorker(loader, subTasks, iterate, seen) } iterate(task, subResults) diff --git a/internal/compiler/parsetask.go b/internal/compiler/parsetask.go index 3143336e72..fab536949f 100644 --- a/internal/compiler/parsetask.go +++ b/internal/compiler/parsetask.go @@ -15,12 +15,15 @@ type parseTask struct { isLib bool isRedirected bool subTasks []*parseTask + loaded bool metadata ast.SourceFileMetaData resolutionsInFile module.ModeAwareCache[*module.ResolvedModule] typeResolutionsInFile module.ModeAwareCache[*module.ResolvedTypeReferenceDirective] importHelpersImportSpecifier *ast.Node jsxRuntimeImportSpecifier *jsxRuntimeImportSpecifier + increaseDepth bool + elideOnDepth bool } func (t *parseTask) FileName() string { @@ -31,7 +34,9 @@ func (t *parseTask) Path() tspath.Path { return t.path } -func (t *parseTask) start(loader *fileLoader) { +func (t *parseTask) load(loader *fileLoader) { + t.loaded = true + t.path = loader.toPath(t.normalizedFilePath) redirect := loader.projectReferenceFileMapper.getParseFileRedirect(t) if redirect != "" { @@ -52,7 +57,6 @@ func (t *parseTask) start(loader *fileLoader) { t.file = file - // !!! if noResolve, skip all of this t.subTasks = make([]*parseTask, 0, len(file.ReferencedFiles)+len(file.Imports())+len(file.ModuleAugmentations)) for _, ref := range file.ReferencedFiles { @@ -73,7 +77,7 @@ func (t *parseTask) start(loader *fileLoader) { if !ok { continue } - t.addSubTask(tspath.CombinePaths(loader.defaultLibraryPath, name), true) + t.addSubTask(resolvedRef{fileName: tspath.CombinePaths(loader.defaultLibraryPath, name)}, true) } } @@ -89,14 +93,34 @@ func (t *parseTask) start(loader *fileLoader) { func (t *parseTask) redirect(loader *fileLoader, fileName string) { t.isRedirected = true + // increaseDepth and elideOnDepth are not copied to redirects, otherwise their depth would be double counted. t.subTasks = []*parseTask{{normalizedFilePath: tspath.NormalizePath(fileName), isLib: t.isLib}} } -func (t *parseTask) addSubTask(fileName string, isLib bool) { - normalizedFilePath := tspath.NormalizePath(fileName) - t.subTasks = append(t.subTasks, &parseTask{normalizedFilePath: normalizedFilePath, isLib: isLib}) +type resolvedRef struct { + fileName string + increaseDepth bool + elideOnDepth bool +} + +func (t *parseTask) addSubTask(ref resolvedRef, isLib bool) { + normalizedFilePath := tspath.NormalizePath(ref.fileName) + subTask := &parseTask{normalizedFilePath: normalizedFilePath, isLib: isLib, increaseDepth: ref.increaseDepth, elideOnDepth: ref.elideOnDepth} + t.subTasks = append(t.subTasks, subTask) } -func getSubTasksOfParseTask(t *parseTask) []*parseTask { +func (t *parseTask) getSubTasks() []*parseTask { return t.subTasks } + +func (t *parseTask) shouldIncreaseDepth() bool { + return t.increaseDepth +} + +func (t *parseTask) shouldElideOnDepth() bool { + return t.elideOnDepth +} + +func (t *parseTask) isLoaded() bool { + return t.loaded +} diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 8cea5d5dea..8928bba703 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -46,16 +46,6 @@ type Program struct { processedFiles - // The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules. - // This works as imported modules are discovered recursively in a depth first manner, specifically: - // - For each root file, findSourceFile is called. - // - This calls processImportedModules for each module imported in the source file. - // - This calls resolveModuleNames, and then calls findSourceFile for each resolved module. - // As all these operations happen - and are nested - within the createProgram call, they close over the below variables. - // The current resolution depth is tracked by incrementing/decrementing as the depth first search progresses. - // maxNodeModuleJsDepth int - currentNodeModulesDepth int - usesUriStyleNodeCoreModules core.Tristate commonSourceDirectory string @@ -194,12 +184,6 @@ func NewProgram(opts ProgramOptions) *Program { } p.initCheckerPool() - // p.maxNodeModuleJsDepth = p.options.MaxNodeModuleJsDepth - - // TODO(ercornel): !!! tracing? - // tracing?.push(tracing.Phase.Program, "createProgram", { configFilePath: options.configFilePath, rootDir: options.rootDir }, /*separateBeginAndEnd*/ true); - // performance.mark("beforeProgram"); - var libs []string if compilerOptions.NoLib != core.TSTrue { @@ -235,7 +219,6 @@ func (p *Program) UpdateProgram(changedFilePath tspath.Path) (*Program, bool) { nodeModules: p.nodeModules, comparePathsOptions: p.comparePathsOptions, processedFiles: p.processedFiles, - currentNodeModulesDepth: p.currentNodeModulesDepth, usesUriStyleNodeCoreModules: p.usesUriStyleNodeCoreModules, } result.initCheckerPool() diff --git a/internal/compiler/projectreferenceparsetask.go b/internal/compiler/projectreferenceparsetask.go index c65dcd6267..647a3f6273 100644 --- a/internal/compiler/projectreferenceparsetask.go +++ b/internal/compiler/projectreferenceparsetask.go @@ -6,6 +6,7 @@ import ( ) type projectReferenceParseTask struct { + loaded bool configName string resolved *tsoptions.ParsedCommandLine subTasks []*projectReferenceParseTask @@ -15,7 +16,9 @@ func (t *projectReferenceParseTask) FileName() string { return t.configName } -func (t *projectReferenceParseTask) start(loader *fileLoader) { +func (t *projectReferenceParseTask) load(loader *fileLoader) { + t.loaded = true + t.resolved = loader.opts.Host.GetResolvedProjectReference(t.configName, loader.toPath(t.configName)) if t.resolved == nil { return @@ -32,10 +35,22 @@ func (t *projectReferenceParseTask) start(loader *fileLoader) { t.subTasks = createProjectReferenceParseTasks(subReferences) } -func getSubTasksOfProjectReferenceParseTask(t *projectReferenceParseTask) []*projectReferenceParseTask { +func (t *projectReferenceParseTask) getSubTasks() []*projectReferenceParseTask { return t.subTasks } +func (t *projectReferenceParseTask) shouldIncreaseDepth() bool { + return false +} + +func (t *projectReferenceParseTask) shouldElideOnDepth() bool { + return false +} + +func (t *projectReferenceParseTask) isLoaded() bool { + return t.loaded +} + func createProjectReferenceParseTasks(projectReferences []string) []*projectReferenceParseTask { return core.Map(projectReferences, func(configName string) *projectReferenceParseTask { return &projectReferenceParseTask{ diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt deleted file mode 100644 index aa8d24f0dc..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt +++ /dev/null @@ -1,51 +0,0 @@ -/packages/main/index.ts(1,19): error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. - Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` - - -==== /packages/main/tsconfig.json (0 errors) ==== - { - "compilerOptions": { - "noEmit": true, - "checkJs": true, - "strict": true, - "module": "esnext", - "moduleResolution": "bundler", - "traceResolution": true, - } - } - - -==== /packages/main/index.ts (1 errors) ==== - import { x } from "shared"; - ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. -!!! error TS7016: Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` - -==== /node_modules/pkg/index.d.ts (0 errors) ==== - export declare function pkg(): "pkg"; - -==== /packages/shared/package.json (0 errors) ==== - { - "name": "shared", - "version": "1.0.0", - "type": "module", - "exports": "./index.js" - } - -==== /packages/shared/utils.js (0 errors) ==== - export { pkg } from "pkg"; - -==== /packages/shared/index.js (0 errors) ==== - import { pkg } from "./utils.js"; - export const x = pkg(); - -==== /packages/main/package.json (0 errors) ==== - { - "name": "main", - "version": "1.0.0", - "type": "module", - "dependencies": { - "shared": "workspace:*" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt.diff deleted file mode 100644 index c1914b50c9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.errors.txt.diff +++ /dev/null @@ -1,55 +0,0 @@ ---- old.allowJsCrossMonorepoPackage.errors.txt -+++ new.allowJsCrossMonorepoPackage.errors.txt -@@= skipped -0, +0 lines =@@ -- -+/packages/main/index.ts(1,19): error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. -+ Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` -+ -+ -+==== /packages/main/tsconfig.json (0 errors) ==== -+ { -+ "compilerOptions": { -+ "noEmit": true, -+ "checkJs": true, -+ "strict": true, -+ "module": "esnext", -+ "moduleResolution": "bundler", -+ "traceResolution": true, -+ } -+ } -+ -+ -+==== /packages/main/index.ts (1 errors) ==== -+ import { x } from "shared"; -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module 'shared'. '/packages/shared/index.js' implicitly has an 'any' type. -+!!! error TS7016: Try `npm i --save-dev @types/shared` if it exists or add a new declaration (.d.ts) file containing `declare module 'shared';` -+ -+==== /node_modules/pkg/index.d.ts (0 errors) ==== -+ export declare function pkg(): "pkg"; -+ -+==== /packages/shared/package.json (0 errors) ==== -+ { -+ "name": "shared", -+ "version": "1.0.0", -+ "type": "module", -+ "exports": "./index.js" -+ } -+ -+==== /packages/shared/utils.js (0 errors) ==== -+ export { pkg } from "pkg"; -+ -+==== /packages/shared/index.js (0 errors) ==== -+ import { pkg } from "./utils.js"; -+ export const x = pkg(); -+ -+==== /packages/main/package.json (0 errors) ==== -+ { -+ "name": "main", -+ "version": "1.0.0", -+ "type": "module", -+ "dependencies": { -+ "shared": "workspace:*" -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols index 2e20d79553..dbdc37a135 100644 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols +++ b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols @@ -4,3 +4,19 @@ import { x } from "shared"; >x : Symbol(x, Decl(index.ts, 0, 8)) +=== /node_modules/pkg/index.d.ts === +export declare function pkg(): "pkg"; +>pkg : Symbol(pkg, Decl(index.d.ts, 0, 0)) + +=== /packages/shared/utils.js === +export { pkg } from "pkg"; +>pkg : Symbol(pkg, Decl(utils.js, 0, 8)) + +=== /packages/shared/index.js === +import { pkg } from "./utils.js"; +>pkg : Symbol(pkg, Decl(index.js, 0, 8)) + +export const x = pkg(); +>x : Symbol(x, Decl(index.js, 1, 12)) +>pkg : Symbol(pkg, Decl(index.js, 0, 8)) + diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols.diff b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols.diff deleted file mode 100644 index 69d3699f37..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.symbols.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.allowJsCrossMonorepoPackage.symbols -+++ new.allowJsCrossMonorepoPackage.symbols -@@= skipped -3, +3 lines =@@ - import { x } from "shared"; - >x : Symbol(x, Decl(index.ts, 0, 8)) - --=== /node_modules/pkg/index.d.ts === --export declare function pkg(): "pkg"; -->pkg : Symbol(pkg, Decl(index.d.ts, 0, 0)) -- --=== /packages/shared/utils.js === --export { pkg } from "pkg"; -->pkg : Symbol(pkg, Decl(utils.js, 0, 8)) -- --=== /packages/shared/index.js === --import { pkg } from "./utils.js"; -->pkg : Symbol(pkg, Decl(index.js, 0, 8)) -- --export const x = pkg(); -->x : Symbol(x, Decl(index.js, 1, 12)) -->pkg : Symbol(pkg, Decl(index.js, 0, 8)) -- \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types index 8472a76ba2..8a0ecbf103 100644 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types +++ b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types @@ -2,5 +2,22 @@ === /packages/main/index.ts === import { x } from "shared"; ->x : any +>x : "pkg" + +=== /node_modules/pkg/index.d.ts === +export declare function pkg(): "pkg"; +>pkg : () => "pkg" + +=== /packages/shared/utils.js === +export { pkg } from "pkg"; +>pkg : () => "pkg" + +=== /packages/shared/index.js === +import { pkg } from "./utils.js"; +>pkg : () => "pkg" + +export const x = pkg(); +>x : "pkg" +>pkg() : "pkg" +>pkg : () => "pkg" diff --git a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types.diff b/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types.diff deleted file mode 100644 index 77e6ed8ace..0000000000 --- a/testdata/baselines/reference/submodule/compiler/allowJsCrossMonorepoPackage.types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.allowJsCrossMonorepoPackage.types -+++ new.allowJsCrossMonorepoPackage.types -@@= skipped -1, +1 lines =@@ - - === /packages/main/index.ts === - import { x } from "shared"; -->x : "pkg" -- --=== /node_modules/pkg/index.d.ts === --export declare function pkg(): "pkg"; -->pkg : () => "pkg" -- --=== /packages/shared/utils.js === --export { pkg } from "pkg"; -->pkg : () => "pkg" -- --=== /packages/shared/index.js === --import { pkg } from "./utils.js"; -->pkg : () => "pkg" -- --export const x = pkg(); -->x : "pkg" -->pkg() : "pkg" -->pkg : () => "pkg" -+>x : any diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols index 245a4ff4c8..146e0f03bc 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols @@ -4,6 +4,7 @@ const _item = require("./namespacer"); >_item : Symbol(_item, Decl(index.js, 0, 5)) >require : Symbol(require) +>"./namespacer" : Symbol("namespacer", Decl(namespacer.js, 0, 0)) module.exports = 12; >module.exports : Symbol(export=, Decl(index.js, 0, 38)) @@ -16,3 +17,43 @@ Object.defineProperty(module, "exports", { value: "oh no" }); >defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) >value : Symbol(value, Decl(index.js, 2, 42)) +=== namespacey.js === +const A = {} +>A : Symbol(A, Decl(namespacey.js, 0, 5)) + +A.bar = class Q {} +>A.bar : Symbol(bar, Decl(namespacey.js, 0, 12)) +>A : Symbol(A, Decl(namespacey.js, 0, 5)) +>bar : Symbol(bar, Decl(namespacey.js, 0, 12)) +>Q : Symbol(Q, Decl(namespacey.js, 1, 7)) + +module.exports = A; +>module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(namespacey.js, 0, 5)) +>A : Symbol(A, Decl(namespacey.js, 0, 5)) + +=== namespacer.js === +const B = {} +>B : Symbol(B, Decl(namespacer.js, 0, 5)) + +B.NS = require("./namespacey"); +>B.NS : Symbol(NS, Decl(namespacer.js, 0, 12)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) +>NS : Symbol(NS, Decl(namespacer.js, 0, 12)) +>require : Symbol(require) + +Object.defineProperty(B, "NS", { value: "why though", writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) +>value : Symbol(value, Decl(namespacer.js, 2, 32)) +>writable : Symbol(writable, Decl(namespacer.js, 2, 53)) + +module.exports = B; +>module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(B, Decl(namespacer.js, 0, 5)) +>B : Symbol(B, Decl(namespacer.js, 0, 5)) + diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff index d57516ef97..325d923238 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols.diff @@ -1,10 +1,7 @@ --- old.ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols +++ new.ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.symbols -@@= skipped -3, +3 lines =@@ - const _item = require("./namespacer"); - >_item : Symbol(_item, Decl(index.js, 0, 5)) - >require : Symbol(require) -->"./namespacer" : Symbol("namespacer", Decl(namespacer.js, 0, 0)) +@@= skipped -6, +6 lines =@@ + >"./namespacer" : Symbol("namespacer", Decl(namespacer.js, 0, 0)) module.exports = 12; ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) @@ -22,45 +19,64 @@ ->"exports" : Symbol(module.exports, Decl(index.js, 1, 20)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) >value : Symbol(value, Decl(index.js, 2, 42)) -- --=== namespacey.js === --const A = {} + + === namespacey.js === + const A = {} ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) -- --A.bar = class Q {} ++>A : Symbol(A, Decl(namespacey.js, 0, 5)) + + A.bar = class Q {} ->A.bar : Symbol(A.bar, Decl(namespacey.js, 0, 12)) ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) ->bar : Symbol(A.bar, Decl(namespacey.js, 0, 12)) -->Q : Symbol(Q, Decl(namespacey.js, 1, 7)) -- --module.exports = A; ++>A.bar : Symbol(bar, Decl(namespacey.js, 0, 12)) ++>A : Symbol(A, Decl(namespacey.js, 0, 5)) ++>bar : Symbol(bar, Decl(namespacey.js, 0, 12)) + >Q : Symbol(Q, Decl(namespacey.js, 1, 7)) + + module.exports = A; ->module.exports : Symbol(module.exports, Decl(namespacey.js, 0, 0)) ->module : Symbol(export=, Decl(namespacey.js, 1, 18)) ->exports : Symbol(export=, Decl(namespacey.js, 1, 18)) ->A : Symbol(A, Decl(namespacey.js, 0, 5), Decl(namespacey.js, 0, 12)) -- --=== namespacer.js === --const B = {} ++>module.exports : Symbol(A, Decl(namespacey.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(namespacey.js, 0, 5)) ++>A : Symbol(A, Decl(namespacey.js, 0, 5)) + + === namespacer.js === + const B = {} ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) -- --B.NS = require("./namespacey"); ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) + + B.NS = require("./namespacey"); ->B.NS : Symbol(B.NS, Decl(namespacer.js, 0, 12), Decl(namespacer.js, 1, 31)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) ->NS : Symbol(B.NS, Decl(namespacer.js, 0, 12), Decl(namespacer.js, 1, 31)) -->require : Symbol(require) ++>B.NS : Symbol(NS, Decl(namespacer.js, 0, 12)) ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) ++>NS : Symbol(NS, Decl(namespacer.js, 0, 12)) + >require : Symbol(require) ->"./namespacey" : Symbol("namespacey", Decl(namespacey.js, 0, 0)) -- --Object.defineProperty(B, "NS", { value: "why though", writable: true }); + + Object.defineProperty(B, "NS", { value: "why though", writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) ->"NS" : Symbol(B.NS, Decl(namespacer.js, 0, 12), Decl(namespacer.js, 1, 31)) -->value : Symbol(value, Decl(namespacer.js, 2, 32)) -->writable : Symbol(writable, Decl(namespacer.js, 2, 53)) -- --module.exports = B; ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) + >value : Symbol(value, Decl(namespacer.js, 2, 32)) + >writable : Symbol(writable, Decl(namespacer.js, 2, 53)) + + module.exports = B; ->module.exports : Symbol(module.exports, Decl(namespacer.js, 0, 0)) ->module : Symbol(export=, Decl(namespacer.js, 2, 72)) ->exports : Symbol(export=, Decl(namespacer.js, 2, 72)) ->B : Symbol(B, Decl(namespacer.js, 0, 5), Decl(namespacer.js, 0, 12), Decl(namespacer.js, 2, 22)) ++>module.exports : Symbol(B, Decl(namespacer.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(B, Decl(namespacer.js, 0, 5)) ++>B : Symbol(B, Decl(namespacer.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types index c6be5e731c..4f72e4fd3c 100644 --- a/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types +++ b/testdata/baselines/reference/submodule/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types @@ -2,8 +2,8 @@ === index.js === const _item = require("./namespacer"); ->_item : any ->require("./namespacer") : any +>_item : { NS: { bar: typeof Q; }; } +>require("./namespacer") : { NS: { bar: typeof Q; }; } >require : any >"./namespacer" : "./namespacer" @@ -25,3 +25,57 @@ Object.defineProperty(module, "exports", { value: "oh no" }); >value : string >"oh no" : "oh no" +=== namespacey.js === +const A = {} +>A : { bar: typeof Q; } +>{} : { bar: typeof Q; } + +A.bar = class Q {} +>A.bar = class Q {} : typeof Q +>A.bar : typeof Q +>A : { bar: typeof Q; } +>bar : typeof Q +>class Q {} : typeof Q +>Q : typeof Q + +module.exports = A; +>module.exports = A : { bar: typeof Q; } +>module.exports : { bar: typeof Q; } +>module : { readonly A: { bar: typeof Q; }; } +>exports : { bar: typeof Q; } +>A : { bar: typeof Q; } + +=== namespacer.js === +const B = {} +>B : { NS: { bar: typeof Q; }; } +>{} : { NS: { bar: typeof Q; }; } + +B.NS = require("./namespacey"); +>B.NS = require("./namespacey") : { bar: typeof Q; } +>B.NS : { bar: typeof Q; } +>B : { NS: { bar: typeof Q; }; } +>NS : { bar: typeof Q; } +>require("./namespacey") : { bar: typeof Q; } +>require : any +>"./namespacey" : "./namespacey" + +Object.defineProperty(B, "NS", { value: "why though", writable: true }); +>Object.defineProperty(B, "NS", { value: "why though", writable: true }) : { NS: { bar: typeof Q; }; } +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>B : { NS: { bar: typeof Q; }; } +>"NS" : "NS" +>{ value: "why though", writable: true } : { value: string; writable: true; } +>value : string +>"why though" : "why though" +>writable : true +>true : true + +module.exports = B; +>module.exports = B : { NS: { bar: typeof Q; }; } +>module.exports : { NS: { bar: typeof Q; }; } +>module : { readonly B: { NS: { bar: typeof Q; }; }; } +>exports : { NS: { bar: typeof Q; }; } +>B : { NS: { bar: typeof Q; }; } + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt new file mode 100644 index 0000000000..2d268cb5a4 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.errors.txt @@ -0,0 +1,50 @@ +index.js(10,12): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? +index.js(17,16): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? + + +==== usage.js (0 errors) ==== + const { Thing, useThing, cbThing } = require("./index"); + + useThing(Thing.a); + + /** + * @typedef {Object} LogEntry + * @property {string} type + * @property {number} time + */ + + cbThing(type => { + /** @type {LogEntry} */ + const logEntry = { + time: Date.now(), + type, + }; + }); + +==== index.js (2 errors) ==== + /** @enum {string} */ + const Thing = Object.freeze({ + a: "thing", + b: "chill" + }); + + exports.Thing = Thing; + + /** + * @param {Thing} x + ~~~~~ +!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? + */ + function useThing(x) {} + + exports.useThing = useThing; + + /** + * @param {(x: Thing) => void} x + ~~~~~ +!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? + */ + function cbThing(x) {} + + exports.cbThing = cbThing; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols index b46908c5b0..22ca93d390 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols @@ -6,10 +6,13 @@ const { Thing, useThing, cbThing } = require("./index"); >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) >cbThing : Symbol(cbThing, Decl(usage.js, 0, 24)) >require : Symbol(require) +>"./index" : Symbol("index", Decl(index.js, 0, 0)) useThing(Thing.a); >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) +>Thing.a : Symbol(a, Decl(index.js, 1, 29)) >Thing : Symbol(Thing, Decl(usage.js, 0, 7)) +>a : Symbol(a, Decl(index.js, 1, 29)) /** * @typedef {Object} LogEntry @@ -37,3 +40,51 @@ cbThing(type => { }; }); +=== index.js === +/** @enum {string} */ +const Thing = Object.freeze({ +>Thing : Symbol(Thing, Decl(index.js, 1, 5)) +>Object.freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + a: "thing", +>a : Symbol(a, Decl(index.js, 1, 29)) + + b: "chill" +>b : Symbol(b, Decl(index.js, 2, 15)) + +}); + +exports.Thing = Thing; +>exports.Thing : Symbol(Thing, Decl(index.js, 4, 3)) +>exports : Symbol("index", Decl(index.js, 0, 0)) +>Thing : Symbol(Thing, Decl(index.js, 4, 3)) +>Thing : Symbol(Thing, Decl(index.js, 1, 5)) + +/** + * @param {Thing} x + */ +function useThing(x) {} +>useThing : Symbol(useThing, Decl(index.js, 6, 22)) +>x : Symbol(x, Decl(index.js, 11, 18)) + +exports.useThing = useThing; +>exports.useThing : Symbol(useThing, Decl(index.js, 11, 23)) +>exports : Symbol("index", Decl(index.js, 0, 0)) +>useThing : Symbol(useThing, Decl(index.js, 11, 23)) +>useThing : Symbol(useThing, Decl(index.js, 6, 22)) + +/** + * @param {(x: Thing) => void} x + */ +function cbThing(x) {} +>cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) +>x : Symbol(x, Decl(index.js, 18, 17)) + +exports.cbThing = cbThing; +>exports.cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) +>exports : Symbol("index", Decl(index.js, 0, 0)) +>cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) +>cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) + diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff index 040b35b093..2a2a752d9e 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.symbols.diff @@ -1,20 +1,6 @@ --- old.jsEnumTagOnObjectFrozen.symbols +++ new.jsEnumTagOnObjectFrozen.symbols -@@= skipped -5, +5 lines =@@ - >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) - >cbThing : Symbol(cbThing, Decl(usage.js, 0, 24)) - >require : Symbol(require) -->"./index" : Symbol("index", Decl(index.js, 0, 0)) - - useThing(Thing.a); - >useThing : Symbol(useThing, Decl(usage.js, 0, 14)) -->Thing.a : Symbol(a, Decl(index.js, 1, 29)) - >Thing : Symbol(Thing, Decl(usage.js, 0, 7)) -->a : Symbol(a, Decl(index.js, 1, 29)) - - /** - * @typedef {Object} LogEntry -@@= skipped -24, +21 lines =@@ +@@= skipped -29, +29 lines =@@ time: Date.now(), >time : Symbol(time, Decl(usage.js, 12, 22)) @@ -26,54 +12,46 @@ type, >type : Symbol(type, Decl(usage.js, 13, 25)) - - }; - }); -- --=== index.js === --/** @enum {string} */ --const Thing = Object.freeze({ +@@= skipped -13, +13 lines =@@ + === index.js === + /** @enum {string} */ + const Thing = Object.freeze({ ->Thing : Symbol(Thing, Decl(index.js, 1, 5), Decl(index.js, 0, 4)) ->Object.freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Thing : Symbol(Thing, Decl(index.js, 1, 5)) ++>Object.freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->freeze : Symbol(ObjectConstructor.freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -- -- a: "thing", -->a : Symbol(a, Decl(index.js, 1, 29)) -- -- b: "chill" -->b : Symbol(b, Decl(index.js, 2, 15)) -- --}); -- --exports.Thing = Thing; -->exports.Thing : Symbol(Thing, Decl(index.js, 4, 3)) ++>freeze : Symbol(freeze, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + a: "thing", + >a : Symbol(a, Decl(index.js, 1, 29)) +@@= skipped -15, +15 lines =@@ + + exports.Thing = Thing; + >exports.Thing : Symbol(Thing, Decl(index.js, 4, 3)) ->exports : Symbol(Thing, Decl(index.js, 4, 3)) -->Thing : Symbol(Thing, Decl(index.js, 4, 3)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) + >Thing : Symbol(Thing, Decl(index.js, 4, 3)) ->Thing : Symbol(Thing, Decl(index.js, 1, 5), Decl(index.js, 0, 4)) -- --/** -- * @param {Thing} x -- */ --function useThing(x) {} -->useThing : Symbol(useThing, Decl(index.js, 6, 22)) -->x : Symbol(x, Decl(index.js, 11, 18)) -- --exports.useThing = useThing; -->exports.useThing : Symbol(useThing, Decl(index.js, 11, 23)) ++>Thing : Symbol(Thing, Decl(index.js, 1, 5)) + + /** + * @param {Thing} x +@@= skipped -13, +13 lines =@@ + + exports.useThing = useThing; + >exports.useThing : Symbol(useThing, Decl(index.js, 11, 23)) ->exports : Symbol(useThing, Decl(index.js, 11, 23)) -->useThing : Symbol(useThing, Decl(index.js, 11, 23)) -->useThing : Symbol(useThing, Decl(index.js, 6, 22)) -- --/** -- * @param {(x: Thing) => void} x -- */ --function cbThing(x) {} -->cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) -->x : Symbol(x, Decl(index.js, 18, 17)) -- --exports.cbThing = cbThing; -->exports.cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) + >useThing : Symbol(useThing, Decl(index.js, 11, 23)) + >useThing : Symbol(useThing, Decl(index.js, 6, 22)) + +@@= skipped -13, +13 lines =@@ + + exports.cbThing = cbThing; + >exports.cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) ->exports : Symbol(cbThing, Decl(index.js, 18, 22)) -->cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) -->cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) ++>exports : Symbol("index", Decl(index.js, 0, 0)) + >cbThing : Symbol(cbThing, Decl(index.js, 18, 22)) + >cbThing : Symbol(cbThing, Decl(index.js, 13, 28)) diff --git a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types index a845130443..935ccf7ad4 100644 --- a/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types +++ b/testdata/baselines/reference/submodule/compiler/jsEnumTagOnObjectFrozen.types @@ -2,19 +2,19 @@ === usage.js === const { Thing, useThing, cbThing } = require("./index"); ->Thing : any ->useThing : any ->cbThing : any ->require("./index") : any +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>useThing : (x: Thing) => void +>cbThing : (x: (x: Thing) => void) => void +>require("./index") : typeof import("./index") >require : any >"./index" : "./index" useThing(Thing.a); ->useThing(Thing.a) : any ->useThing : any ->Thing.a : any ->Thing : any ->a : any +>useThing(Thing.a) : void +>useThing : (x: Thing) => void +>Thing.a : "thing" +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>a : "thing" /** * @typedef {Object} LogEntry @@ -23,15 +23,15 @@ useThing(Thing.a); */ cbThing(type => { ->cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : any ->cbThing : any ->type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: any) => void ->type : any +>cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : void +>cbThing : (x: (x: Thing) => void) => void +>type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: Thing) => void +>type : Thing /** @type {LogEntry} */ const logEntry = { >logEntry : LogEntry ->{ time: Date.now(), type, } : { time: number; type: any; } +>{ time: Date.now(), type, } : { time: number; type: Thing; } time: Date.now(), >time : number @@ -41,8 +41,63 @@ cbThing(type => { >now : () => number type, ->type : any +>type : Thing }; }); +=== index.js === +/** @enum {string} */ +const Thing = Object.freeze({ +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ a: "thing"; b: "chill"; }> +>Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>Object : ObjectConstructor +>freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } +>{ a: "thing", b: "chill"} : { a: "thing"; b: "chill"; } + + a: "thing", +>a : "thing" +>"thing" : "thing" + + b: "chill" +>b : "chill" +>"chill" : "chill" + +}); + +exports.Thing = Thing; +>exports.Thing = Thing : Readonly<{ a: "thing"; b: "chill"; }> +>exports.Thing : Readonly<{ a: "thing"; b: "chill"; }> +>exports : typeof import(".") +>Thing : Readonly<{ a: "thing"; b: "chill"; }> +>Thing : Readonly<{ a: "thing"; b: "chill"; }> + +/** + * @param {Thing} x + */ +function useThing(x) {} +>useThing : (x: Thing) => void +>x : Thing + +exports.useThing = useThing; +>exports.useThing = useThing : (x: Thing) => void +>exports.useThing : (x: Thing) => void +>exports : typeof import(".") +>useThing : (x: Thing) => void +>useThing : (x: Thing) => void + +/** + * @param {(x: Thing) => void} x + */ +function cbThing(x) {} +>cbThing : (x: (x: Thing) => void) => void +>x : (x: Thing) => void + +exports.cbThing = cbThing; +>exports.cbThing = cbThing : (x: (x: Thing) => void) => void +>exports.cbThing : (x: (x: Thing) => void) => void +>exports : typeof import(".") +>cbThing : (x: (x: Thing) => void) => void +>cbThing : (x: (x: Thing) => void) => void + diff --git a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js b/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js index e27cdb8eb5..4c554e23c8 100644 --- a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js +++ b/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js @@ -9,9 +9,9 @@ declare module "./missingFunctionImplementation2_b" { //// [missingFunctionImplementation2_b.ts] export function f(a?, b?); -//// [missingFunctionImplementation2_b.js] +//// [missingFunctionImplementation2_a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//// [missingFunctionImplementation2_a.js] +//// [missingFunctionImplementation2_b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js.diff b/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js.diff deleted file mode 100644 index b93cf2426d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/missingFunctionImplementation2.js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.missingFunctionImplementation2.js -+++ new.missingFunctionImplementation2.js -@@= skipped -8, +8 lines =@@ - //// [missingFunctionImplementation2_b.ts] - export function f(a?, b?); - --//// [missingFunctionImplementation2_a.js] -+//// [missingFunctionImplementation2_b.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --//// [missingFunctionImplementation2_b.js] -+//// [missingFunctionImplementation2_a.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js index 79a13fcabe..653c0fc501 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js +++ b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js @@ -50,6 +50,13 @@ import "./x"; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; exports.a = 1; +//// [x.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var N1; +(function (N1) { + N1.x = 1; +})(N1 || (N1 = {})); //// [observable.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -60,13 +67,6 @@ exports.x = 1; Object.defineProperty(exports, "__esModule", { value: true }); exports.b = void 0; exports.b = 1; -//// [x.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var N1; -(function (N1) { - N1.x = 1; -})(N1 || (N1 = {})); //// [main.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js.diff b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js.diff deleted file mode 100644 index 5c38bd1388..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDisallowedExtensions.js.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.moduleAugmentationDisallowedExtensions.js -+++ new.moduleAugmentationDisallowedExtensions.js -@@= skipped -49, +49 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.a = void 0; - exports.a = 1; --//// [x.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --var N1; --(function (N1) { -- N1.x = 1; --})(N1 || (N1 = {})); - //// [observable.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -17, +10 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.b = void 0; - exports.b = 1; -+//// [x.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+var N1; -+(function (N1) { -+ N1.x = 1; -+})(N1 || (N1 = {})); - //// [main.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt index 03300ec63b..fd2276e9f7 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt @@ -1,14 +1,10 @@ -eslint.config.js(1,29): error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. -eslint.config.js(2,26): error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. +typescript-eslint.js(12,17): error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. +typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== eslint.config.js (2 errors) ==== +==== eslint.config.js (0 errors) ==== const eslintReact = require('./eslint-plugin-react.js'); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. const tseslint = require('./typescript-eslint.js'); - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. tseslint.config(eslintReact) @@ -30,7 +26,7 @@ eslint.config.js(2,26): error TS7016: Could not find a declaration file for modu }, }; -==== typescript-eslint.js (0 errors) ==== +==== typescript-eslint.js (2 errors) ==== /** * @typedef {{ rules: Record }} Plugin */ @@ -43,6 +39,10 @@ eslint.config.js(2,26): error TS7016: Could not find a declaration file for modu * @type {(...configs: Config[]) => void} */ function config(...configs) { } + ~~~~~~~~~~ +!!! error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. module.exports = { config }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols index e05a7fe633..5ea722d79d 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols @@ -4,12 +4,75 @@ const eslintReact = require('./eslint-plugin-react.js'); >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) >require : Symbol(require) +>'./eslint-plugin-react.js' : Symbol("eslint-plugin-react", Decl(eslint-plugin-react.js, 0, 0)) const tseslint = require('./typescript-eslint.js'); >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) >require : Symbol(require) +>'./typescript-eslint.js' : Symbol("typescript-eslint", Decl(typescript-eslint.js, 0, 0)) tseslint.config(eslintReact) +>tseslint.config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) +>config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) +=== eslint-plugin-react.js === +const deprecatedRules = { +>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 0, 5)) + + "jsx-sort-default-props": true +>"jsx-sort-default-props" : Symbol("jsx-sort-default-props", Decl(eslint-plugin-react.js, 0, 25)) +} + +const allRules = { +>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) + + 'no-unsafe': true +>'no-unsafe' : Symbol('no-unsafe', Decl(eslint-plugin-react.js, 4, 18)) +} + +module.exports = { +>module.exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) + + plugins: { +>plugins : Symbol(plugins, Decl(eslint-plugin-react.js, 8, 18)) + + react: { +>react : Symbol(react, Decl(eslint-plugin-react.js, 9, 12)) + + deprecatedRules, +>deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 10, 12)) + + rules: allRules, +>rules : Symbol(rules, Decl(eslint-plugin-react.js, 11, 22)) +>allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) + + }, + }, +}; + +=== typescript-eslint.js === +/** + * @typedef {{ rules: Record }} Plugin + */ + +/** + * @typedef {{ plugins: Record }} Config + */ + +/** + * @type {(...configs: Config[]) => void} + */ +function config(...configs) { } +>config : Symbol(config, Decl(typescript-eslint.js, 0, 0)) +>configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16)) + +module.exports = { config }; +>module.exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) +>config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) + diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff index d14a3ca0fe..c3a004ee08 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols.diff @@ -1,77 +1,40 @@ --- old.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols +++ new.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.symbols -@@= skipped -3, +3 lines =@@ - const eslintReact = require('./eslint-plugin-react.js'); - >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) - >require : Symbol(require) -->'./eslint-plugin-react.js' : Symbol("eslint-plugin-react", Decl(eslint-plugin-react.js, 0, 0)) - +@@= skipped -8, +8 lines =@@ const tseslint = require('./typescript-eslint.js'); >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) >require : Symbol(require) ->'./typescript-eslint.js' : Symbol(tseslint, Decl(typescript-eslint.js, 0, 0)) ++>'./typescript-eslint.js' : Symbol("typescript-eslint", Decl(typescript-eslint.js, 0, 0)) tseslint.config(eslintReact) ->tseslint.config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18)) ++>tseslint.config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >tseslint : Symbol(tseslint, Decl(eslint.config.js, 1, 5)) ->config : Symbol(tseslint.config, Decl(typescript-eslint.js, 13, 18)) ++>config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) >eslintReact : Symbol(eslintReact, Decl(eslint.config.js, 0, 5)) -- --=== eslint-plugin-react.js === --const deprecatedRules = { -->deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 0, 5)) -- -- "jsx-sort-default-props": true -->"jsx-sort-default-props" : Symbol("jsx-sort-default-props", Decl(eslint-plugin-react.js, 0, 25)) --} -- --const allRules = { -->allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) -- -- 'no-unsafe': true -->'no-unsafe' : Symbol('no-unsafe', Decl(eslint-plugin-react.js, 4, 18)) --} -- --module.exports = { + + === eslint-plugin-react.js === +@@= skipped -24, +24 lines =@@ + } + + module.exports = { ->module.exports : Symbol(module.exports, Decl(eslint-plugin-react.js, 0, 0)) ->module : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) -->exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) -- -- plugins: { -->plugins : Symbol(plugins, Decl(eslint-plugin-react.js, 8, 18)) -- -- react: { -->react : Symbol(react, Decl(eslint-plugin-react.js, 9, 12)) -- -- deprecatedRules, -->deprecatedRules : Symbol(deprecatedRules, Decl(eslint-plugin-react.js, 10, 12)) -- -- rules: allRules, -->rules : Symbol(rules, Decl(eslint-plugin-react.js, 11, 22)) -->allRules : Symbol(allRules, Decl(eslint-plugin-react.js, 4, 5)) -- -- }, -- }, --}; -- --=== typescript-eslint.js === --/** -- * @typedef {{ rules: Record }} Plugin -- */ -- --/** -- * @typedef {{ plugins: Record }} Config -- */ -- --/** -- * @type {(...configs: Config[]) => void} -- */ --function config(...configs) { } -->config : Symbol(config, Decl(typescript-eslint.js, 0, 0)) -->configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16)) -- --module.exports = { config }; ++>module.exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(eslint-plugin-react.js, 6, 1)) + + plugins: { +@@= skipped -38, +38 lines =@@ + >configs : Symbol(configs, Decl(typescript-eslint.js, 11, 16)) + + module.exports = { config }; ->module.exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0)) ->module : Symbol(module, Decl(typescript-eslint.js, 11, 31)) ->exports : Symbol(module.exports, Decl(typescript-eslint.js, 0, 0)) -->config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) ++>module.exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(typescript-eslint.js, 11, 31)) + >config : Symbol(config, Decl(typescript-eslint.js, 13, 18)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types index 464fc0be72..b805edc844 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types +++ b/testdata/baselines/reference/submodule/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types @@ -2,21 +2,90 @@ === eslint.config.js === const eslintReact = require('./eslint-plugin-react.js'); ->eslintReact : any ->require('./eslint-plugin-react.js') : any +>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } >require : any >'./eslint-plugin-react.js' : "./eslint-plugin-react.js" const tseslint = require('./typescript-eslint.js'); ->tseslint : any ->require('./typescript-eslint.js') : any +>tseslint : { config: (...configs: any[]) => void; } +>require('./typescript-eslint.js') : { config: (...configs: any[]) => void; } >require : any >'./typescript-eslint.js' : "./typescript-eslint.js" tseslint.config(eslintReact) ->tseslint.config(eslintReact) : any ->tseslint.config : any ->tseslint : any ->config : any ->eslintReact : any +>tseslint.config(eslintReact) : void +>tseslint.config : (...configs: any[]) => void +>tseslint : { config: (...configs: any[]) => void; } +>config : (...configs: any[]) => void +>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + +=== eslint-plugin-react.js === +const deprecatedRules = { +>deprecatedRules : { "jsx-sort-default-props": boolean; } +>{ "jsx-sort-default-props": true} : { "jsx-sort-default-props": boolean; } + + "jsx-sort-default-props": true +>"jsx-sort-default-props" : boolean +>true : true +} + +const allRules = { +>allRules : { "no-unsafe": boolean; } +>{ 'no-unsafe': true} : { "no-unsafe": boolean; } + + 'no-unsafe': true +>'no-unsafe' : boolean +>true : true +} + +module.exports = { +>module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>module : { "export=": { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; }; } +>exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } +>{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + + plugins: { +>plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } +>{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } + + react: { +>react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } +>{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } + + deprecatedRules, +>deprecatedRules : { "jsx-sort-default-props": boolean; } + + rules: allRules, +>rules : { "no-unsafe": boolean; } +>allRules : { "no-unsafe": boolean; } + + }, + }, +}; + +=== typescript-eslint.js === +/** + * @typedef {{ rules: Record }} Plugin + */ + +/** + * @typedef {{ plugins: Record }} Config + */ + +/** + * @type {(...configs: Config[]) => void} + */ +function config(...configs) { } +>config : (...configs: any[]) => void +>configs : any[] + +module.exports = { config }; +>module.exports = { config } : { config: (...configs: any[]) => void; } +>module.exports : { config: (...configs: any[]) => void; } +>module : { "export=": { config: (...configs: any[]) => void; }; } +>exports : { config: (...configs: any[]) => void; } +>{ config } : { config: (...configs: any[]) => void; } +>config : (...configs: any[]) => void diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js b/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js index c56c3bd15a..805d4925a2 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js @@ -7,11 +7,11 @@ import a = require('./b'); export var c = ''; +//// [a.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); //// [b.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.c = void 0; exports.c = ''; -//// [a.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js.diff deleted file mode 100644 index ea3a587f95..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionNoResolve.js.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.moduleResolutionNoResolve.js -+++ new.moduleResolutionNoResolve.js -@@= skipped -6, +6 lines =@@ - export var c = ''; - - --//// [a.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - //// [b.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.c = void 0; - exports.c = ''; -+//// [a.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt index a033a08480..b756d61a76 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt @@ -1,10 +1,10 @@ -/a.ts(1,17): error TS2306: File '/tsx.tsx' is not a module. +/a.ts(1,17): error TS2307: Cannot find module './tsx' or its corresponding type declarations. ==== /a.ts (1 errors) ==== import tsx from "./tsx"; // Not allowed. ~~~~~~~ -!!! error TS2306: File '/tsx.tsx' is not a module. +!!! error TS2307: Cannot find module './tsx' or its corresponding type declarations. import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff index 2c86f94389..ac4179cf7c 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff @@ -6,14 +6,14 @@ - - -==== /a.ts (2 errors) ==== -+/a.ts(1,17): error TS2306: File '/tsx.tsx' is not a module. ++/a.ts(1,17): error TS2307: Cannot find module './tsx' or its corresponding type declarations. + + +==== /a.ts (1 errors) ==== import tsx from "./tsx"; // Not allowed. ~~~~~~~ -!!! error TS6142: Module './tsx' was resolved to '/tsx.tsx', but '--jsx' is not set. -+!!! error TS2306: File '/tsx.tsx' is not a module. ++!!! error TS2307: Cannot find module './tsx' or its corresponding type declarations. import jsx from "./jsx"; // Not allowed. - ~~~~~~~ -!!! error TS6142: Module './jsx' was resolved to '/jsx.jsx', but '--jsx' is not set. diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js index 227fbc2f1c..66c323b005 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js @@ -12,7 +12,6 @@ import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. -//// [tsx.js] //// [a.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js.diff deleted file mode 100644 index b70735a823..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.moduleResolutionWithExtensions_notSupported.js -+++ new.moduleResolutionWithExtensions_notSupported.js -@@= skipped -11, +11 lines =@@ - import js from "./js"; // OK because it's an untyped module. - - -+//// [tsx.js] - //// [a.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols index 7bc8195165..0a10d073ac 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols @@ -10,5 +10,3 @@ import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. >js : Symbol(js, Decl(a.ts, 2, 6)) -=== /tsx.tsx === - diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols.diff deleted file mode 100644 index 5b29a22046..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.symbols.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.moduleResolutionWithExtensions_notSupported.symbols -+++ new.moduleResolutionWithExtensions_notSupported.symbols -@@= skipped -9, +9 lines =@@ - import js from "./js"; // OK because it's an untyped module. - >js : Symbol(js, Decl(a.ts, 2, 6)) - -+=== /tsx.tsx === -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types index b5d9603425..60c5e5876b 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types @@ -10,5 +10,3 @@ import jsx from "./jsx"; // Not allowed. import js from "./js"; // OK because it's an untyped module. >js : any -=== /tsx.tsx === - diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types.diff deleted file mode 100644 index 05b174fd9c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.types.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.moduleResolutionWithExtensions_notSupported.types -+++ new.moduleResolutionWithExtensions_notSupported.types -@@= skipped -9, +9 lines =@@ - import js from "./js"; // OK because it's an untyped module. - >js : any - -+=== /tsx.tsx === -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols index f2913b8182..952599a809 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols +++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols @@ -4,3 +4,9 @@ import { x } from "../node_modules/foo"; >x : Symbol(x, Decl(index.ts, 0, 8)) +=== /node_modules/foo/index.js === +exports.x = 0; +>exports.x : Symbol(x, Decl(index.js, 0, 0)) +>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) +>x : Symbol(x, Decl(index.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff index 48ff1bbf6e..ec3db09aa2 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.symbols.diff @@ -1,12 +1,9 @@ --- old.moduleResolution_explicitNodeModulesImport.symbols +++ new.moduleResolution_explicitNodeModulesImport.symbols -@@= skipped -3, +3 lines =@@ - import { x } from "../node_modules/foo"; - >x : Symbol(x, Decl(index.ts, 0, 8)) - --=== /node_modules/foo/index.js === --exports.x = 0; -->exports.x : Symbol(x, Decl(index.js, 0, 0)) +@@= skipped -6, +6 lines =@@ + === /node_modules/foo/index.js === + exports.x = 0; + >exports.x : Symbol(x, Decl(index.js, 0, 0)) ->exports : Symbol(x, Decl(index.js, 0, 0)) -->x : Symbol(x, Decl(index.js, 0, 0)) -- \ No newline at end of file ++>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) + >x : Symbol(x, Decl(index.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types index 2a2ce37bc4..67d34851b5 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types +++ b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types @@ -2,5 +2,13 @@ === /src/index.ts === import { x } from "../node_modules/foo"; ->x : any +>x : 0 + +=== /node_modules/foo/index.js === +exports.x = 0; +>exports.x = 0 : 0 +>exports.x : 0 +>exports : typeof import("foo") +>x : 0 +>0 : 0 diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types.diff b/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types.diff deleted file mode 100644 index 630fd31648..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolution_explicitNodeModulesImport.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.moduleResolution_explicitNodeModulesImport.types -+++ new.moduleResolution_explicitNodeModulesImport.types -@@= skipped -1, +1 lines =@@ - - === /src/index.ts === - import { x } from "../node_modules/foo"; -->x : 0 -- --=== /node_modules/foo/index.js === --exports.x = 0; -->exports.x = 0 : 0 -->exports.x : 0 -->exports : typeof import("/node_modules/foo/index") -->x : 0 -->0 : 0 -+>x : any diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols index 0c7788ec5f..6e0b0e75fc 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols @@ -11,3 +11,7 @@ import { bar } from "/bar"; export function foo() {} >foo : Symbol(foo, Decl(foo.ts, 0, 0)) +=== /bar.js === +export function bar() {} +>bar : Symbol(bar, Decl(bar.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols.diff deleted file mode 100644 index c30898bf6f..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.symbols -@@= skipped -10, +10 lines =@@ - export function foo() {} - >foo : Symbol(foo, Decl(foo.ts, 0, 0)) - --=== /bar.js === --export function bar() {} -->bar : Symbol(bar, Decl(bar.js, 0, 0)) -- \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types index 8912ae5e8d..e189dff5ab 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types @@ -5,9 +5,13 @@ import { foo } from "/foo"; >foo : () => void import { bar } from "/bar"; ->bar : any +>bar : () => void === /foo.ts === export function foo() {} >foo : () => void +=== /bar.js === +export function bar() {} +>bar : () => void + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types.diff deleted file mode 100644 index 67dd6a4fda..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types -+++ new.pathMappingBasedModuleResolution_rootImport_aliasWithRoot_realRootFile.types -@@= skipped -4, +4 lines =@@ - >foo : () => void - - import { bar } from "/bar"; -->bar : () => void -+>bar : any - - === /foo.ts === - export function foo() {} - >foo : () => void -- --=== /bar.js === --export function bar() {} -->bar : () => void diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols index 24988bbfbe..d048de95e6 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols @@ -11,3 +11,7 @@ import { bar } from "/bar"; export function foo() {} >foo : Symbol(foo, Decl(foo.ts, 0, 0)) +=== /bar.js === +export function bar() {} +>bar : Symbol(bar, Decl(bar.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols.diff deleted file mode 100644 index cc74837d30..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols -+++ new.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.symbols -@@= skipped -10, +10 lines =@@ - export function foo() {} - >foo : Symbol(foo, Decl(foo.ts, 0, 0)) - --=== /bar.js === --export function bar() {} -->bar : Symbol(bar, Decl(bar.js, 0, 0)) -- \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types index b2a131dd24..54630514ac 100644 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types +++ b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types @@ -5,9 +5,13 @@ import { foo } from "/foo"; >foo : () => void import { bar } from "/bar"; ->bar : any +>bar : () => void === /foo.ts === export function foo() {} >foo : () => void +=== /bar.js === +export function bar() {} +>bar : () => void + diff --git a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types.diff b/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types.diff deleted file mode 100644 index c9aa92e057..0000000000 --- a/testdata/baselines/reference/submodule/compiler/pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types -+++ new.pathMappingBasedModuleResolution_rootImport_noAliasWithRoot_realRootFile.types -@@= skipped -4, +4 lines =@@ - >foo : () => void - - import { bar } from "/bar"; -->bar : () => void -+>bar : any - - === /foo.ts === - export function foo() {} - >foo : () => void -- --=== /bar.js === --export function bar() {} -->bar : () => void diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt index ce6e3565a7..247aaa31b5 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.errors.txt @@ -1,11 +1,10 @@ /user.js(2,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. /user.js(5,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -/user.js(8,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. /user.js(9,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. -/user.js(12,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. +/user.js(12,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -==== /user.js (5 errors) ==== +==== /user.js (4 errors) ==== const json0 = require("./json.json"); json0.b; // Error (good) ~ @@ -19,16 +18,15 @@ json1.b; // No error (OK since that's the type annotation) const js0 = require("./js.js"); - ~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. json0.b; // Error (good) ~ !!! error TS2339: Property 'b' does not exist on type '{ a: number; }'. /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) - ~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. + ~~~ +!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. +!!! related TS2728 /user.js:11:14: 'b' is declared here. js1.b; ==== /json.json (0 errors) ==== { "a": 0 } diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols index ce9272af12..9f3eb97f2f 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols @@ -22,6 +22,7 @@ json1.b; // No error (OK since that's the type annotation) const js0 = require("./js.js"); >js0 : Symbol(js0, Decl(user.js, 7, 5)) >require : Symbol(require) +>"./js.js" : Symbol("/js", Decl(js.js, 0, 0)) json0.b; // Error (good) >json0 : Symbol(json0, Decl(user.js, 0, 5)) @@ -40,3 +41,10 @@ js1.b; { "a": 0 } >"a" : Symbol("a", Decl(json.json, 0, 1)) +=== /js.js === +module.exports = { a: 0 }; +>module.exports : Symbol(export=, Decl(js.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(js.js, 0, 0)) +>a : Symbol(a, Decl(js.js, 0, 18)) + diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff index f07c1f94db..4c49920155 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.symbols.diff @@ -8,15 +8,7 @@ json1.b; // No error (OK since that's the type annotation) >json1.b : Symbol(b, Decl(user.js, 3, 12)) -@@= skipped -10, +9 lines =@@ - const js0 = require("./js.js"); - >js0 : Symbol(js0, Decl(user.js, 7, 5)) - >require : Symbol(require) -->"./js.js" : Symbol("/js", Decl(js.js, 0, 0)) - - json0.b; // Error (good) - >json0 : Symbol(json0, Decl(user.js, 0, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -19, +18 lines =@@ const js1 = require("./js.js"); // Error (good) >js1 : Symbol(js1, Decl(user.js, 11, 5)) >require : Symbol(require) @@ -24,14 +16,13 @@ js1.b; >js1.b : Symbol(b, Decl(user.js, 10, 12)) -@@= skipped -10, +9 lines =@@ - === /json.json === - { "a": 0 } - >"a" : Symbol("a", Decl(json.json, 0, 1)) -- --=== /js.js === --module.exports = { a: 0 }; +@@= skipped -13, +12 lines =@@ + + === /js.js === + module.exports = { a: 0 }; ->module.exports : Symbol(module.exports, Decl(js.js, 0, 0)) ->module : Symbol(export=, Decl(js.js, 0, 0)) -->exports : Symbol(export=, Decl(js.js, 0, 0)) -->a : Symbol(a, Decl(js.js, 0, 18)) ++>module.exports : Symbol(export=, Decl(js.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(js.js, 0, 0)) + >a : Symbol(a, Decl(js.js, 0, 18)) diff --git a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types index 664584e335..82a79912d2 100644 --- a/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types +++ b/testdata/baselines/reference/submodule/compiler/requireOfJsonFileInJsFile.types @@ -25,8 +25,8 @@ json1.b; // No error (OK since that's the type annotation) >b : number const js0 = require("./js.js"); ->js0 : any ->require("./js.js") : any +>js0 : { a: number; } +>require("./js.js") : { a: number; } >require : any >"./js.js" : "./js.js" @@ -38,7 +38,7 @@ json0.b; // Error (good) /** @type {{ b: number }} */ const js1 = require("./js.js"); // Error (good) >js1 : { b: number; } ->require("./js.js") : any +>require("./js.js") : { a: number; } >require : any >"./js.js" : "./js.js" @@ -53,3 +53,13 @@ js1.b; >"a" : number >0 : 0 +=== /js.js === +module.exports = { a: 0 }; +>module.exports = { a: 0 } : { a: number; } +>module.exports : { a: number; } +>module : { "export=": { a: number; }; } +>exports : { a: number; } +>{ a: 0 } : { a: number; } +>a : number +>0 : 0 + diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt index 9f96511b1a..54fcff7501 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.errors.txt @@ -1,13 +1,16 @@ -use.js(2,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. +use.js(3,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +use.js(4,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -==== use.js (1 errors) ==== +==== use.js (2 errors) ==== /// var mod = require('./mod'); - ~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. var a = new mod.A() + ~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. var b = new mod.B() + ~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. a.m('nope') b.m('not really') diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols index 791a5288d2..7d83e2d1a6 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols @@ -5,14 +5,19 @@ var mod = require('./mod'); >mod : Symbol(mod, Decl(use.js, 1, 3)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) +>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) var a = new mod.A() >a : Symbol(a, Decl(use.js, 2, 3)) +>mod.A : Symbol(A, Decl(mod.js, 6, 1)) >mod : Symbol(mod, Decl(use.js, 1, 3)) +>A : Symbol(A, Decl(mod.js, 6, 1)) var b = new mod.B() >b : Symbol(b, Decl(use.js, 3, 3)) +>mod.B : Symbol(B, Decl(mod.js, 7, 13)) >mod : Symbol(mod, Decl(use.js, 1, 3)) +>B : Symbol(B, Decl(mod.js, 7, 13)) a.m('nope') >a : Symbol(a, Decl(use.js, 2, 3)) @@ -28,3 +33,47 @@ declare function require(name: string): any; declare var exports: any; >exports : Symbol(exports, Decl(types.d.ts, 1, 11)) +=== mod.js === +/// +var A = function A() { +>A : Symbol(A, Decl(mod.js, 1, 3)) +>A : Symbol(A, Decl(mod.js, 1, 7)) + + this.a = 1 +} +var B = function B() { +>B : Symbol(B, Decl(mod.js, 4, 3)) +>B : Symbol(B, Decl(mod.js, 4, 7)) + + this.b = 2 +} +exports.A = A +>exports.A : Symbol(A, Decl(mod.js, 6, 1)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>A : Symbol(A, Decl(mod.js, 6, 1)) +>A : Symbol(A, Decl(mod.js, 1, 3)) + +exports.B = B +>exports.B : Symbol(B, Decl(mod.js, 7, 13)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>B : Symbol(B, Decl(mod.js, 7, 13)) +>B : Symbol(B, Decl(mod.js, 4, 3)) + +A.prototype = B.prototype = { +>A.prototype : Symbol(prototype, Decl(mod.js, 8, 13)) +>A : Symbol(A, Decl(mod.js, 1, 3)) +>prototype : Symbol(prototype, Decl(mod.js, 8, 13)) +>B.prototype : Symbol(prototype, Decl(mod.js, 9, 13)) +>B : Symbol(B, Decl(mod.js, 4, 3)) +>prototype : Symbol(prototype, Decl(mod.js, 9, 13)) + + /** @param {number} n */ + m(n) { +>m : Symbol(m, Decl(mod.js, 9, 29)) +>n : Symbol(n, Decl(mod.js, 11, 6)) + + return n + 1 +>n : Symbol(n, Decl(mod.js, 11, 6)) + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff index e1ca2a180b..678af985d9 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.symbols.diff @@ -5,18 +5,23 @@ >mod : Symbol(mod, Decl(use.js, 1, 3)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) ->'./mod' : Symbol(mod, Decl(mod.js, 0, 0)) ++>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) var a = new mod.A() >a : Symbol(a, Decl(use.js, 2, 3)) ->mod.A : Symbol(mod.A, Decl(mod.js, 6, 1)) ++>mod.A : Symbol(A, Decl(mod.js, 6, 1)) >mod : Symbol(mod, Decl(use.js, 1, 3)) ->A : Symbol(mod.A, Decl(mod.js, 6, 1)) ++>A : Symbol(A, Decl(mod.js, 6, 1)) var b = new mod.B() >b : Symbol(b, Decl(use.js, 3, 3)) ->mod.B : Symbol(mod.B, Decl(mod.js, 7, 13)) ++>mod.B : Symbol(B, Decl(mod.js, 7, 13)) >mod : Symbol(mod, Decl(use.js, 1, 3)) ->B : Symbol(mod.B, Decl(mod.js, 7, 13)) ++>B : Symbol(B, Decl(mod.js, 7, 13)) a.m('nope') ->a.m : Symbol(m, Decl(mod.js, 9, 29)) @@ -30,57 +35,58 @@ === types.d.ts === declare function require(name: string): any; -@@= skipped -31, +22 lines =@@ - - declare var exports: any; - >exports : Symbol(exports, Decl(types.d.ts, 1, 11)) -- --=== mod.js === --/// --var A = function A() { +@@= skipped -35, +31 lines =@@ + === mod.js === + /// + var A = function A() { ->A : Symbol(A, Decl(mod.js, 1, 3), Decl(mod.js, 8, 13)) -->A : Symbol(A, Decl(mod.js, 1, 7)) -- -- this.a = 1 ++>A : Symbol(A, Decl(mod.js, 1, 3)) + >A : Symbol(A, Decl(mod.js, 1, 7)) + + this.a = 1 ->this.a : Symbol(A.a, Decl(mod.js, 1, 22)) ->this : Symbol(A, Decl(mod.js, 1, 7)) ->a : Symbol(A.a, Decl(mod.js, 1, 22)) --} --var B = function B() { + } + var B = function B() { ->B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13)) -->B : Symbol(B, Decl(mod.js, 4, 7)) -- -- this.b = 2 ++>B : Symbol(B, Decl(mod.js, 4, 3)) + >B : Symbol(B, Decl(mod.js, 4, 7)) + + this.b = 2 ->this.b : Symbol(B.b, Decl(mod.js, 4, 22)) ->this : Symbol(B, Decl(mod.js, 4, 7)) ->b : Symbol(B.b, Decl(mod.js, 4, 22)) --} --exports.A = A -->exports.A : Symbol(A, Decl(mod.js, 6, 1)) + } + exports.A = A + >exports.A : Symbol(A, Decl(mod.js, 6, 1)) ->exports : Symbol(A, Decl(mod.js, 6, 1)) -->A : Symbol(A, Decl(mod.js, 6, 1)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >A : Symbol(A, Decl(mod.js, 6, 1)) ->A : Symbol(A, Decl(mod.js, 1, 3), Decl(mod.js, 8, 13)) -- --exports.B = B -->exports.B : Symbol(B, Decl(mod.js, 7, 13)) ++>A : Symbol(A, Decl(mod.js, 1, 3)) + + exports.B = B + >exports.B : Symbol(B, Decl(mod.js, 7, 13)) ->exports : Symbol(B, Decl(mod.js, 7, 13)) -->B : Symbol(B, Decl(mod.js, 7, 13)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >B : Symbol(B, Decl(mod.js, 7, 13)) ->B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13)) -- --A.prototype = B.prototype = { ++>B : Symbol(B, Decl(mod.js, 4, 3)) + + A.prototype = B.prototype = { ->A.prototype : Symbol(A.prototype, Decl(mod.js, 8, 13)) ->A : Symbol(A, Decl(mod.js, 1, 3), Decl(mod.js, 8, 13)) ->prototype : Symbol(A.prototype, Decl(mod.js, 8, 13)) ->B.prototype : Symbol(B.prototype, Decl(mod.js, 9, 13)) ->B : Symbol(B, Decl(mod.js, 4, 3), Decl(mod.js, 9, 13)) ->prototype : Symbol(B.prototype, Decl(mod.js, 9, 13)) -- -- /** @param {number} n */ -- m(n) { -->m : Symbol(m, Decl(mod.js, 9, 29)) -->n : Symbol(n, Decl(mod.js, 11, 6)) -- -- return n + 1 -->n : Symbol(n, Decl(mod.js, 11, 6)) -- } --} ++>A.prototype : Symbol(prototype, Decl(mod.js, 8, 13)) ++>A : Symbol(A, Decl(mod.js, 1, 3)) ++>prototype : Symbol(prototype, Decl(mod.js, 8, 13)) ++>B.prototype : Symbol(prototype, Decl(mod.js, 9, 13)) ++>B : Symbol(B, Decl(mod.js, 4, 3)) ++>prototype : Symbol(prototype, Decl(mod.js, 9, 13)) + + /** @param {number} n */ + m(n) { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types index a3627f661a..4dbebc0c05 100644 --- a/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/chainedPrototypeAssignment.types @@ -3,24 +3,24 @@ === use.js === /// var mod = require('./mod'); ->mod : any ->require('./mod') : any +>mod : typeof mod +>require('./mod') : typeof mod >require : (name: string) => any >'./mod' : "./mod" var a = new mod.A() >a : any >new mod.A() : any ->mod.A : any ->mod : any ->A : any +>mod.A : { (): void; prototype: { m(n: number): number; }; } +>mod : typeof mod +>A : { (): void; prototype: { m(n: number): number; }; } var b = new mod.B() >b : any >new mod.B() : any ->mod.B : any ->mod : any ->B : any +>mod.B : { (): void; prototype: { m(n: number): number; }; } +>mod : typeof mod +>B : { (): void; prototype: { m(n: number): number; }; } a.m('nope') >a.m('nope') : any @@ -44,3 +44,66 @@ declare function require(name: string): any; declare var exports: any; >exports : any +=== mod.js === +/// +var A = function A() { +>A : { (): void; prototype: { m(n: number): number; }; } +>function A() { this.a = 1} : { (): void; prototype: { m(n: number): number; }; } +>A : { (): void; prototype: { m(n: number): number; }; } + + this.a = 1 +>this.a = 1 : 1 +>this.a : any +>this : any +>a : any +>1 : 1 +} +var B = function B() { +>B : { (): void; prototype: { m(n: number): number; }; } +>function B() { this.b = 2} : { (): void; prototype: { m(n: number): number; }; } +>B : { (): void; prototype: { m(n: number): number; }; } + + this.b = 2 +>this.b = 2 : 2 +>this.b : any +>this : any +>b : any +>2 : 2 +} +exports.A = A +>exports.A = A : { (): void; prototype: { m(n: number): number; }; } +>exports.A : { (): void; prototype: { m(n: number): number; }; } +>exports : typeof import("./mod") +>A : { (): void; prototype: { m(n: number): number; }; } +>A : { (): void; prototype: { m(n: number): number; }; } + +exports.B = B +>exports.B = B : { (): void; prototype: { m(n: number): number; }; } +>exports.B : { (): void; prototype: { m(n: number): number; }; } +>exports : typeof import("./mod") +>B : { (): void; prototype: { m(n: number): number; }; } +>B : { (): void; prototype: { m(n: number): number; }; } + +A.prototype = B.prototype = { +>A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } +>A.prototype : { m(n: number): number; } +>A : { (): void; prototype: { m(n: number): number; }; } +>prototype : { m(n: number): number; } +>B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } +>B.prototype : { m(n: number): number; } +>B : { (): void; prototype: { m(n: number): number; }; } +>prototype : { m(n: number): number; } +>{ /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } + + /** @param {number} n */ + m(n) { +>m : (n: number) => number +>n : number + + return n + 1 +>n + 1 : number +>n : number +>1 : 1 + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt index 01aee03b63..db9ca448b3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt @@ -1,5 +1,17 @@ -validator.ts(3,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. -validator.ts(23,21): error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. +index.js(4,19): error TS2306: File 'mod1.js' is not a module. +index.js(9,19): error TS2306: File 'mod2.js' is not a module. +mod1.js(1,23): error TS2304: Cannot find name 'exports'. +mod1.js(2,23): error TS2304: Cannot find name 'exports'. +mod1.js(3,23): error TS2304: Cannot find name 'exports'. +mod1.js(4,23): error TS2304: Cannot find name 'exports'. +mod1.js(5,23): error TS2304: Cannot find name 'exports'. +mod2.js(1,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(2,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod2.js(5,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +validator.ts(3,21): error TS2306: File 'mod1.js' is not a module. +validator.ts(23,21): error TS2306: File 'mod2.js' is not a module. ==== validator.ts (2 errors) ==== @@ -7,7 +19,7 @@ validator.ts(23,21): error TS7016: Could not find a declaration file for module import m1 = require("./mod1"); ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +!!! error TS2306: File 'mod1.js' is not a module. m1.thing; m1.readonlyProp; @@ -29,7 +41,7 @@ validator.ts(23,21): error TS7016: Could not find a declaration file for module import m2 = require("./mod2"); ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. +!!! error TS2306: File 'mod2.js' is not a module. m2.thing; m2.readonlyProp; @@ -49,38 +61,62 @@ validator.ts(23,21): error TS7016: Could not find a declaration file for module m2.rwAccessors = "no"; m2.setonlyAccessor = 0; -==== mod1.js (0 errors) ==== +==== mod1.js (5 errors) ==== Object.defineProperty(exports, "thing", { value: 42, writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "setonlyAccessor", { + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. /** @param {string} str */ set(str) { this.rwAccessors = Number(str) } }); -==== mod2.js (0 errors) ==== +==== mod2.js (5 errors) ==== Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. Object.defineProperty(module.exports, "setonlyAccessor", { + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. /** @param {string} str */ set(str) { this.rwAccessors = Number(str) } }); -==== index.js (0 errors) ==== +==== index.js (2 errors) ==== /** * @type {number} */ const q = require("./mod1").thing; + ~~~~~~~~ +!!! error TS2306: File 'mod1.js' is not a module. /** * @type {string} */ const u = require("./mod2").thing; + ~~~~~~~~ +!!! error TS2306: File 'mod2.js' is not a module. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt.diff deleted file mode 100644 index 4643514dff..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.errors.txt.diff +++ /dev/null @@ -1,75 +0,0 @@ ---- old.checkExportsObjectAssignProperty.errors.txt -+++ new.checkExportsObjectAssignProperty.errors.txt -@@= skipped -0, +0 lines =@@ --validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. --validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. --validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'. --validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'. --validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'. --validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. --validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. --validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'. --validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'number'. --validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. -- -- --==== validator.ts (10 errors) ==== -+validator.ts(3,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. -+validator.ts(23,21): error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. -+ -+ -+==== validator.ts (2 errors) ==== - import "./"; - - import m1 = require("./mod1"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. - - m1.thing; - m1.readonlyProp; -@@= skipped -27, +21 lines =@@ - - // disallowed assignments - m1.readonlyProp = "name"; -- ~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. - m1.readonlyAccessor = 12; -- ~~~~~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. - m1.thing = "no"; -- ~~~~~~~~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - m1.rwAccessors = "no"; -- ~~~~~~~~~~~~~~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - m1.setonlyAccessor = 0; -- ~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - - import m2 = require("./mod2"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod2'. 'mod2.js' implicitly has an 'any' type. - - m2.thing; - m2.readonlyProp; -@@= skipped -30, +22 lines =@@ - - // disallowed assignments - m2.readonlyProp = "name"; -- ~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. - m2.readonlyAccessor = 12; -- ~~~~~~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. - m2.thing = 0; -- ~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - m2.rwAccessors = "no"; -- ~~~~~~~~~~~~~~ --!!! error TS2322: Type 'string' is not assignable to type 'number'. - m2.setonlyAccessor = 0; -- ~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - - ==== mod1.js (0 errors) ==== - Object.defineProperty(exports, "thing", { value: 42, writable: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols index 88e351f6fc..6ca428e500 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols @@ -91,3 +91,108 @@ m2.rwAccessors = "no"; m2.setonlyAccessor = 0; >m2 : Symbol(m2, Decl(validator.ts, 20, 23)) +=== mod1.js === +Object.defineProperty(exports, "thing", { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 0, 41)) +>writable : Symbol(writable, Decl(mod1.js, 0, 52)) + +Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 1, 48)) +>writable : Symbol(writable, Decl(mod1.js, 1, 64)) + +Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 2, 47)) +>set : Symbol(set, Decl(mod1.js, 2, 71)) +>_ : Symbol(_, Decl(mod1.js, 2, 76)) + +Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 3, 52)) + +Object.defineProperty(exports, "setonlyAccessor", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(mod1.js, 4, 51)) +>str : Symbol(str, Decl(mod1.js, 6, 8)) + + this.rwAccessors = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod1.js, 6, 8)) + } +}); + +=== mod2.js === +Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod2.js, 0, 48)) +>writable : Symbol(writable, Decl(mod2.js, 0, 62)) + +Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod2.js, 1, 55)) +>writable : Symbol(writable, Decl(mod2.js, 1, 71)) + +Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod2.js, 2, 54)) +>set : Symbol(set, Decl(mod2.js, 2, 78)) +>_ : Symbol(_, Decl(mod2.js, 2, 83)) + +Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod2.js, 3, 59)) + +Object.defineProperty(module.exports, "setonlyAccessor", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(mod2.js, 4, 58)) +>str : Symbol(str, Decl(mod2.js, 6, 8)) + + this.rwAccessors = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod2.js, 6, 8)) + } +}); + +=== index.js === +/** + * @type {number} + */ +const q = require("./mod1").thing; +>q : Symbol(q, Decl(index.js, 3, 5)) +>require : Symbol(require) + +/** + * @type {string} + */ +const u = require("./mod2").thing; +>u : Symbol(u, Decl(index.js, 8, 5)) +>require : Symbol(require) + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff index 0c4e0757ea..d162070662 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.symbols.diff @@ -139,146 +139,162 @@ ->m2.setonlyAccessor : Symbol(m2.setonlyAccessor, Decl(mod2.js, 3, 86)) >m2 : Symbol(m2, Decl(validator.ts, 20, 23)) ->setonlyAccessor : Symbol(m2.setonlyAccessor, Decl(mod2.js, 3, 86)) -- --=== mod1.js === --Object.defineProperty(exports, "thing", { value: 42, writable: true }); + + === mod1.js === + Object.defineProperty(exports, "thing", { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"thing" : Symbol(thing, Decl(mod1.js, 0, 0)) -->value : Symbol(value, Decl(mod1.js, 0, 41)) -->writable : Symbol(writable, Decl(mod1.js, 0, 52)) -- --Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 0, 41)) + >writable : Symbol(writable, Decl(mod1.js, 0, 52)) + + Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"readonlyProp" : Symbol(readonlyProp, Decl(mod1.js, 0, 71)) -->value : Symbol(value, Decl(mod1.js, 1, 48)) -->writable : Symbol(writable, Decl(mod1.js, 1, 64)) -- --Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 1, 48)) + >writable : Symbol(writable, Decl(mod1.js, 1, 64)) + + Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"rwAccessors" : Symbol(rwAccessors, Decl(mod1.js, 1, 84)) -->get : Symbol(get, Decl(mod1.js, 2, 47)) -->set : Symbol(set, Decl(mod1.js, 2, 71)) -->_ : Symbol(_, Decl(mod1.js, 2, 76)) -- --Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 2, 47)) + >set : Symbol(set, Decl(mod1.js, 2, 71)) + >_ : Symbol(_, Decl(mod1.js, 2, 76)) + + Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"readonlyAccessor" : Symbol(readonlyAccessor, Decl(mod1.js, 2, 97)) -->get : Symbol(get, Decl(mod1.js, 3, 52)) -- --Object.defineProperty(exports, "setonlyAccessor", { ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 3, 52)) + + Object.defineProperty(exports, "setonlyAccessor", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"setonlyAccessor" : Symbol(setonlyAccessor, Decl(mod1.js, 3, 79)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(mod1.js, 4, 51)) -->str : Symbol(str, Decl(mod1.js, 6, 8)) -- -- this.rwAccessors = Number(str) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +@@= skipped -186, +124 lines =@@ + >str : Symbol(str, Decl(mod1.js, 6, 8)) + + this.rwAccessors = Number(str) ->rwAccessors : Symbol(rwAccessors, Decl(mod1.js, 6, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(mod1.js, 6, 8)) -- } --}); -- --=== mod2.js === --Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod1.js, 6, 8)) + } +@@= skipped -8, +7 lines =@@ + + === mod2.js === + Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"thing" : Symbol(thing, Decl(mod2.js, 0, 0)) -->value : Symbol(value, Decl(mod2.js, 0, 48)) -->writable : Symbol(writable, Decl(mod2.js, 0, 62)) -- --Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod2.js, 0, 48)) + >writable : Symbol(writable, Decl(mod2.js, 0, 62)) + + Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"readonlyProp" : Symbol(readonlyProp, Decl(mod2.js, 0, 81)) -->value : Symbol(value, Decl(mod2.js, 1, 55)) -->writable : Symbol(writable, Decl(mod2.js, 1, 71)) -- --Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod2.js, 1, 55)) + >writable : Symbol(writable, Decl(mod2.js, 1, 71)) + + Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"rwAccessors" : Symbol(rwAccessors, Decl(mod2.js, 1, 91)) -->get : Symbol(get, Decl(mod2.js, 2, 54)) -->set : Symbol(set, Decl(mod2.js, 2, 78)) -->_ : Symbol(_, Decl(mod2.js, 2, 83)) -- --Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod2.js, 2, 54)) + >set : Symbol(set, Decl(mod2.js, 2, 78)) + >_ : Symbol(_, Decl(mod2.js, 2, 83)) + + Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"readonlyAccessor" : Symbol(readonlyAccessor, Decl(mod2.js, 2, 104)) -->get : Symbol(get, Decl(mod2.js, 3, 59)) -- --Object.defineProperty(module.exports, "setonlyAccessor", { ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod2.js, 3, 59)) + + Object.defineProperty(module.exports, "setonlyAccessor", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->module : Symbol(module, Decl(mod2.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod2.js, 0, 0)) ->"setonlyAccessor" : Symbol(setonlyAccessor, Decl(mod2.js, 3, 86)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(mod2.js, 4, 58)) -->str : Symbol(str, Decl(mod2.js, 6, 8)) -- -- this.rwAccessors = Number(str) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +@@= skipped -58, +38 lines =@@ + >str : Symbol(str, Decl(mod2.js, 6, 8)) + + this.rwAccessors = Number(str) ->rwAccessors : Symbol(rwAccessors, Decl(mod2.js, 6, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(mod2.js, 6, 8)) -- } --}); -- --=== index.js === --/** -- * @type {number} -- */ --const q = require("./mod1").thing; -->q : Symbol(q, Decl(index.js, 3, 5)) + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod2.js, 6, 8)) + } +@@= skipped -12, +11 lines =@@ + */ + const q = require("./mod1").thing; + >q : Symbol(q, Decl(index.js, 3, 5)) ->require("./mod1").thing : Symbol(thing, Decl(mod1.js, 0, 0)) -->require : Symbol(require) + >require : Symbol(require) ->"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) ->thing : Symbol(thing, Decl(mod1.js, 0, 0)) -- --/** -- * @type {string} -- */ --const u = require("./mod2").thing; -->u : Symbol(u, Decl(index.js, 8, 5)) + + /** + * @type {string} + */ + const u = require("./mod2").thing; + >u : Symbol(u, Decl(index.js, 8, 5)) ->require("./mod2").thing : Symbol(thing, Decl(mod2.js, 0, 0)) -->require : Symbol(require) + >require : Symbol(require) ->"./mod2" : Symbol("mod2", Decl(mod2.js, 0, 0)) ->thing : Symbol(thing, Decl(mod2.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types index f054d833a8..a743cd286c 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types @@ -175,3 +175,188 @@ m2.setonlyAccessor = 0; >setonlyAccessor : any >0 : 0 +=== mod1.js === +Object.defineProperty(exports, "thing", { value: 42, writable: true }); +>Object.defineProperty(exports, "thing", { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"thing" : "thing" +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + +Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"readonlyProp" : "readonlyProp" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"rwAccessors" : "rwAccessors" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"readonlyAccessor" : "readonlyAccessor" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(exports, "setonlyAccessor", { +>Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"setonlyAccessor" : "setonlyAccessor" +>{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.rwAccessors = Number(str) +>this.rwAccessors = Number(str) : number +>this.rwAccessors : any +>this : any +>rwAccessors : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); + +=== mod2.js === +Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); +>Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"thing" : "thing" +>{ value: "yes", writable: true } : { value: string; writable: true; } +>value : string +>"yes" : "yes" +>writable : true +>true : true + +Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"readonlyProp" : "readonlyProp" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"rwAccessors" : "rwAccessors" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"readonlyAccessor" : "readonlyAccessor" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(module.exports, "setonlyAccessor", { +>Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : any +>module : any +>exports : any +>"setonlyAccessor" : "setonlyAccessor" +>{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.rwAccessors = Number(str) +>this.rwAccessors = Number(str) : number +>this.rwAccessors : any +>this : any +>rwAccessors : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); + +=== index.js === +/** + * @type {number} + */ +const q = require("./mod1").thing; +>q : number +>require("./mod1").thing : any +>require("./mod1") : any +>require : any +>"./mod1" : "./mod1" +>thing : any + +/** + * @type {string} + */ +const u = require("./mod2").thing; +>u : string +>require("./mod2").thing : any +>require("./mod2") : any +>require : any +>"./mod2" : "./mod2" +>thing : any + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt index d2fb479a94..15c06af9b4 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt @@ -1,14 +1,15 @@ -validator.ts(3,25): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +mod1.js(6,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. +validator.ts(5,12): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== validator.ts (1 errors) ==== import "./"; import Person = require("./mod1"); - ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. const m1 = new Person("Name") + ~~~~~~~~~~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. m1.thing; m1.readonlyProp; @@ -29,13 +30,15 @@ validator.ts(3,25): error TS7016: Could not find a declaration file for module ' m1.setonlyAccessor = 0; -==== mod1.js (0 errors) ==== +==== mod1.js (1 errors) ==== /** * @constructor * @param {string} name */ function Person(name) { this.name = name; + ~~~~ +!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. } Person.prototype.describe = function () { return "Person called " + this.name; diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols index 38e3c7f227..6b6cc08719 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols @@ -52,3 +52,86 @@ m1.setonlyAccessor = 0; >m1 : Symbol(m1, Decl(validator.ts, 4, 5)) +=== mod1.js === +/** + * @constructor + * @param {string} name + */ +function Person(name) { +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>name : Symbol(name, Decl(mod1.js, 4, 16)) + + this.name = name; +>name : Symbol(name, Decl(mod1.js, 4, 16)) +} +Person.prototype.describe = function () { +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + return "Person called " + this.name; +}; +Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 10, 50)) +>writable : Symbol(writable, Decl(mod1.js, 10, 61)) + +Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>value : Symbol(value, Decl(mod1.js, 11, 57)) +>writable : Symbol(writable, Decl(mod1.js, 11, 73)) + +Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 12, 56)) +>set : Symbol(set, Decl(mod1.js, 12, 80)) +>_ : Symbol(_, Decl(mod1.js, 12, 85)) + +Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 13, 61)) + +Object.defineProperty(Person.prototype, "setonlyAccessor", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(mod1.js, 14, 60)) +>str : Symbol(str, Decl(mod1.js, 16, 8)) + + this.rwAccessors = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod1.js, 16, 8)) + } +}); +module.exports = Person; +>module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(Person, Decl(mod1.js, 0, 0)) +>Person : Symbol(Person, Decl(mod1.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff index d39aaf1ec1..18f65d0d8d 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.symbols.diff @@ -69,104 +69,123 @@ ->m1.setonlyAccessor : Symbol(Person.setonlyAccessor, Decl(mod1.js, 13, 88)) >m1 : Symbol(m1, Decl(validator.ts, 4, 5)) ->setonlyAccessor : Symbol(Person.setonlyAccessor, Decl(mod1.js, 13, 88)) -- -- --=== mod1.js === --/** -- * @constructor -- * @param {string} name -- */ --function Person(name) { -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) -->name : Symbol(name, Decl(mod1.js, 4, 16)) -- -- this.name = name; + + + === mod1.js === +@@= skipped -77, +51 lines =@@ + >name : Symbol(name, Decl(mod1.js, 4, 16)) + + this.name = name; ->this.name : Symbol(Person.name, Decl(mod1.js, 4, 23)) ->this : Symbol(Person, Decl(mod1.js, 0, 0)) ->name : Symbol(Person.name, Decl(mod1.js, 4, 23)) -->name : Symbol(name, Decl(mod1.js, 4, 16)) --} --Person.prototype.describe = function () { + >name : Symbol(name, Decl(mod1.js, 4, 16)) + } + Person.prototype.describe = function () { ->Person.prototype : Symbol(Person.describe, Decl(mod1.js, 6, 1)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->describe : Symbol(Person.describe, Decl(mod1.js, 6, 1)) -- -- return "Person called " + this.name; ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + return "Person called " + this.name; ->this.name : Symbol(Person.name, Decl(mod1.js, 4, 23)) ->this : Symbol(Person, Decl(mod1.js, 0, 0)) ->name : Symbol(Person.name, Decl(mod1.js, 4, 23)) - --}; --Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); + }; + Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"thing" : Symbol(Person.thing, Decl(mod1.js, 9, 2)) -->value : Symbol(value, Decl(mod1.js, 10, 50)) -->writable : Symbol(writable, Decl(mod1.js, 10, 61)) -- --Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 10, 50)) + >writable : Symbol(writable, Decl(mod1.js, 10, 61)) + + Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"readonlyProp" : Symbol(Person.readonlyProp, Decl(mod1.js, 10, 80)) -->value : Symbol(value, Decl(mod1.js, 11, 57)) -->writable : Symbol(writable, Decl(mod1.js, 11, 73)) -- --Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >value : Symbol(value, Decl(mod1.js, 11, 57)) + >writable : Symbol(writable, Decl(mod1.js, 11, 73)) + + Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"rwAccessors" : Symbol(Person.rwAccessors, Decl(mod1.js, 11, 93)) -->get : Symbol(get, Decl(mod1.js, 12, 56)) -->set : Symbol(set, Decl(mod1.js, 12, 80)) -->_ : Symbol(_, Decl(mod1.js, 12, 85)) -- --Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 12, 56)) + >set : Symbol(set, Decl(mod1.js, 12, 80)) + >_ : Symbol(_, Decl(mod1.js, 12, 85)) + + Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"readonlyAccessor" : Symbol(Person.readonlyAccessor, Decl(mod1.js, 12, 106)) -->get : Symbol(get, Decl(mod1.js, 13, 61)) -- --Object.defineProperty(Person.prototype, "setonlyAccessor", { ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 13, 61)) + + Object.defineProperty(Person.prototype, "setonlyAccessor", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->Person.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>Person.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->"setonlyAccessor" : Symbol(Person.setonlyAccessor, Decl(mod1.js, 13, 88)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(mod1.js, 14, 60)) -->str : Symbol(str, Decl(mod1.js, 16, 8)) -- -- this.rwAccessors = Number(str) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + /** @param {string} str */ + set(str) { +@@= skipped -76, +63 lines =@@ + >str : Symbol(str, Decl(mod1.js, 16, 8)) + + this.rwAccessors = Number(str) ->this.rwAccessors : Symbol(Person.rwAccessors, Decl(mod1.js, 11, 93)) ->this : Symbol(Person, Decl(mod1.js, 0, 0)) ->rwAccessors : Symbol(rwAccessors, Decl(mod1.js, 16, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(mod1.js, 16, 8)) -- } --}); --module.exports = Person; + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod1.js, 16, 8)) + } + }); + module.exports = Person; ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 19, 3)) ->exports : Symbol(export=, Decl(mod1.js, 19, 3)) -->Person : Symbol(Person, Decl(mod1.js, 0, 0)) -+ ++>module.exports : Symbol(Person, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(Person, Decl(mod1.js, 0, 0)) + >Person : Symbol(Person, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types index 9f5d4aaaa0..96e3ff07e3 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types @@ -4,12 +4,12 @@ import "./"; import Person = require("./mod1"); ->Person : any +>Person : (name: string) => void const m1 = new Person("Name") >m1 : any >new Person("Name") : any ->Person : any +>Person : (name: string) => void >"Name" : "Name" m1.thing; @@ -96,3 +96,127 @@ m1.setonlyAccessor = 0; >0 : 0 +=== mod1.js === +/** + * @constructor + * @param {string} name + */ +function Person(name) { +>Person : (name: string) => void +>name : string + + this.name = name; +>this.name = name : string +>this.name : any +>this : any +>name : any +>name : string +} +Person.prototype.describe = function () { +>Person.prototype.describe = function () { return "Person called " + this.name;} : () => string +>Person.prototype.describe : any +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>describe : any +>function () { return "Person called " + this.name;} : () => string + + return "Person called " + this.name; +>"Person called " + this.name : string +>"Person called " : "Person called " +>this.name : any +>this : any +>name : any + +}; +Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); +>Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"thing" : "thing" +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + +Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); +>Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"readonlyProp" : "readonlyProp" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"rwAccessors" : "rwAccessors" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); +>Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"readonlyAccessor" : "readonlyAccessor" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(Person.prototype, "setonlyAccessor", { +>Object.defineProperty(Person.prototype, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Person.prototype : any +>Person : (name: string) => void +>prototype : any +>"setonlyAccessor" : "setonlyAccessor" +>{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.rwAccessors = Number(str) +>this.rwAccessors = Number(str) : number +>this.rwAccessors : any +>this : any +>rwAccessors : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); +module.exports = Person; +>module.exports = Person : (name: string) => void +>module.exports : (name: string) => void +>module : { Person(name: string): void; } +>exports : (name: string) => void +>Person : (name: string) => void + diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types.diff b/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types.diff deleted file mode 100644 index cac0370523..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.types.diff +++ /dev/null @@ -1,260 +0,0 @@ ---- old.checkExportsObjectAssignPrototypeProperty.types -+++ new.checkExportsObjectAssignPrototypeProperty.types -@@= skipped -3, +3 lines =@@ - import "./"; - - import Person = require("./mod1"); -->Person : typeof Person -+>Person : any - - const m1 = new Person("Name") -->m1 : Person -->new Person("Name") : Person -->Person : typeof Person -+>m1 : any -+>new Person("Name") : any -+>Person : any - >"Name" : "Name" - - m1.thing; -->m1.thing : number -->m1 : Person -->thing : number -+>m1.thing : any -+>m1 : any -+>thing : any - - m1.readonlyProp; -->m1.readonlyProp : string -->m1 : Person -->readonlyProp : string -+>m1.readonlyProp : any -+>m1 : any -+>readonlyProp : any - - m1.rwAccessors; -->m1.rwAccessors : number -->m1 : Person -->rwAccessors : number -+>m1.rwAccessors : any -+>m1 : any -+>rwAccessors : any - - m1.readonlyAccessor; -->m1.readonlyAccessor : number -->m1 : Person -->readonlyAccessor : number -+>m1.readonlyAccessor : any -+>m1 : any -+>readonlyAccessor : any - - m1.setonlyAccessor; -->m1.setonlyAccessor : string -->m1 : Person -->setonlyAccessor : string -+>m1.setonlyAccessor : any -+>m1 : any -+>setonlyAccessor : any - - // allowed assignments - m1.thing = 10; - >m1.thing = 10 : 10 -->m1.thing : number -->m1 : Person -->thing : number -+>m1.thing : any -+>m1 : any -+>thing : any - >10 : 10 - - m1.rwAccessors = 11; - >m1.rwAccessors = 11 : 11 -->m1.rwAccessors : number -->m1 : Person -->rwAccessors : number -+>m1.rwAccessors : any -+>m1 : any -+>rwAccessors : any - >11 : 11 - - m1.setonlyAccessor = "yes"; - >m1.setonlyAccessor = "yes" : "yes" -->m1.setonlyAccessor : string -->m1 : Person -->setonlyAccessor : string -+>m1.setonlyAccessor : any -+>m1 : any -+>setonlyAccessor : any - >"yes" : "yes" - - // disallowed assignments - m1.readonlyProp = "name"; - >m1.readonlyProp = "name" : "name" - >m1.readonlyProp : any -->m1 : Person -+>m1 : any - >readonlyProp : any - >"name" : "name" - - m1.readonlyAccessor = 12; - >m1.readonlyAccessor = 12 : 12 - >m1.readonlyAccessor : any -->m1 : Person -+>m1 : any - >readonlyAccessor : any - >12 : 12 - - m1.thing = "no"; - >m1.thing = "no" : "no" -->m1.thing : number -->m1 : Person -->thing : number -+>m1.thing : any -+>m1 : any -+>thing : any - >"no" : "no" - - m1.rwAccessors = "no"; - >m1.rwAccessors = "no" : "no" -->m1.rwAccessors : number -->m1 : Person -->rwAccessors : number -+>m1.rwAccessors : any -+>m1 : any -+>rwAccessors : any - >"no" : "no" - - m1.setonlyAccessor = 0; - >m1.setonlyAccessor = 0 : 0 -->m1.setonlyAccessor : string -->m1 : Person -->setonlyAccessor : string -+>m1.setonlyAccessor : any -+>m1 : any -+>setonlyAccessor : any - >0 : 0 - -- --=== mod1.js === --/** -- * @constructor -- * @param {string} name -- */ --function Person(name) { -->Person : typeof Person -->name : string -- -- this.name = name; -->this.name = name : string -->this.name : any -->this : this -->name : any -->name : string --} --Person.prototype.describe = function () { -->Person.prototype.describe = function () { return "Person called " + this.name;} : () => string -->Person.prototype.describe : any -->Person.prototype : any -->Person : typeof Person -->prototype : any -->describe : any -->function () { return "Person called " + this.name;} : () => string -- -- return "Person called " + this.name; -->"Person called " + this.name : string -->"Person called " : "Person called " -->this.name : string -->this : this -->name : string -- --}; --Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); -->Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"thing" : "thing" -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- --Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }); -->Object.defineProperty(Person.prototype, "readonlyProp", { value: "Smith", writable: false }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"readonlyProp" : "readonlyProp" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); -->Object.defineProperty(Person.prototype, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"rwAccessors" : "rwAccessors" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }); -->Object.defineProperty(Person.prototype, "readonlyAccessor", { get() { return 21.75 } }) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"readonlyAccessor" : "readonlyAccessor" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(Person.prototype, "setonlyAccessor", { -->Object.defineProperty(Person.prototype, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Person.prototype : any -->Person : typeof Person -->prototype : any -->"setonlyAccessor" : "setonlyAccessor" -->{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.rwAccessors = Number(str) -->this.rwAccessors = Number(str) : number -->this.rwAccessors : number -->this : this -->rwAccessors : number -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); --module.exports = Person; -->module.exports = Person : typeof Person -->module.exports : typeof Person -->module : { exports: typeof Person; } -->exports : typeof Person -->Person : typeof Person diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt index 988e6d0f38..26d070eca5 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt @@ -1,28 +1,67 @@ -validate.ts(2,20): error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. +index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. +index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. +index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. +validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. +validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. +validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. +validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. +validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. +validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. +validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. +validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. +validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. -==== validate.ts (1 errors) ==== +==== validate.ts (13 errors) ==== // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); - ~~~~ -!!! error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. x.name; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type '{}'. x.middleInit; + ~~~~~~~~~~ +!!! error TS2339: Property 'middleInit' does not exist on type '{}'. x.lastName; + ~~~~~~~~ +!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.zip; + ~~~ +!!! error TS2339: Property 'zip' does not exist on type '{}'. x.houseNumber; + ~~~~~~~~~~~ +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr; + ~~~~~~ +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.name = "Another"; + ~~~~ +!!! error TS2339: Property 'name' does not exist on type '{}'. x.zip = 98123; + ~~~ +!!! error TS2339: Property 'zip' does not exist on type '{}'. x.zipStr = "OK"; + ~~~~~~ +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.lastName = "should fail"; + ~~~~~~~~ +!!! error TS2339: Property 'lastName' does not exist on type '{}'. x.houseNumber = 12; // should also fail + ~~~~~~~~~~~ +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. x.zipStr = 12; // should fail + ~~~~~~ +!!! error TS2339: Property 'zipStr' does not exist on type '{}'. x.middleInit = "R"; // should also fail + ~~~~~~~~~~ +!!! error TS2339: Property 'middleInit' does not exist on type '{}'. -==== index.js (0 errors) ==== +==== index.js (3 errors) ==== const x = {}; Object.defineProperty(x, "name", { value: "Charles", writable: true }); Object.defineProperty(x, "middleInit", { value: "H" }); @@ -42,15 +81,22 @@ validate.ts(2,20): error TS7016: Could not find a declaration file for module '. function takeName(named) { return named.name; } takeName(x); + ~ +!!! error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. +!!! related TS2728 index.js:15:13: 'name' is declared here. /** * @type {number} */ var a = x.zip; + ~~~ +!!! error TS2339: Property 'zip' does not exist on type '{}'. /** * @type {number} */ var b = x.houseNumber; + ~~~~~~~~~~~ +!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. const returnExemplar = () => x; const needsExemplar = (_ = x) => void 0; diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt.diff deleted file mode 100644 index a93789fa9f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.checkObjectDefineProperty.errors.txt -+++ new.checkObjectDefineProperty.errors.txt -@@= skipped -0, +0 lines =@@ --validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property. --validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. --validate.ts(16,1): error TS2322: Type 'number' is not assignable to type 'string'. --validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property. -- -- --==== validate.ts (4 errors) ==== -+validate.ts(2,20): error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. -+ -+ -+==== validate.ts (1 errors) ==== - // Validate in TS as simple validations would usually be interpreted as more special assignments - import x = require("./"); -+ ~~~~ -+!!! error TS7016: Could not find a declaration file for module './'. 'index.js' implicitly has an 'any' type. - x.name; - x.middleInit; - x.lastName; -@@= skipped -18, +17 lines =@@ - x.zipStr = "OK"; - - x.lastName = "should fail"; -- ~~~~~~~~ --!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property. - x.houseNumber = 12; // should also fail -- ~~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. - x.zipStr = 12; // should fail -- ~~~~~~~~ --!!! error TS2322: Type 'number' is not assignable to type 'string'. - x.middleInit = "R"; // should also fail -- ~~~~~~~~~~ --!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. - - ==== index.js (0 errors) ==== - const x = {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols index af5cca6dd2..fb8fb1c8c0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols @@ -44,3 +44,125 @@ x.zipStr = 12; // should fail x.middleInit = "R"; // should also fail >x : Symbol(x, Decl(validate.ts, 0, 0)) +=== index.js === +const x = {}; +>x : Symbol(x, Decl(index.js, 0, 5)) + +Object.defineProperty(x, "name", { value: "Charles", writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>value : Symbol(value, Decl(index.js, 1, 34)) +>writable : Symbol(writable, Decl(index.js, 1, 52)) + +Object.defineProperty(x, "middleInit", { value: "H" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>value : Symbol(value, Decl(index.js, 2, 40)) + +Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>value : Symbol(value, Decl(index.js, 3, 38)) +>writable : Symbol(writable, Decl(index.js, 3, 54)) + +Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>get : Symbol(get, Decl(index.js, 4, 33)) +>set : Symbol(set, Decl(index.js, 4, 57)) +>_ : Symbol(_, Decl(index.js, 4, 62)) + +Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) +>get : Symbol(get, Decl(index.js, 5, 41)) + +Object.defineProperty(x, "zipStr", { +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(index.js, 0, 5)) + + /** @param {string} str */ + set(str) { +>set : Symbol(set, Decl(index.js, 6, 36)) +>str : Symbol(str, Decl(index.js, 8, 8)) + + this.zip = Number(str) +>Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(index.js, 8, 8)) + } +}); + +/** + * @param {{name: string}} named + */ +function takeName(named) { return named.name; } +>takeName : Symbol(takeName, Decl(index.js, 11, 3)) +>named : Symbol(named, Decl(index.js, 16, 18)) +>named.name : Symbol(name, Decl(index.js, 14, 12)) +>named : Symbol(named, Decl(index.js, 16, 18)) +>name : Symbol(name, Decl(index.js, 14, 12)) + +takeName(x); +>takeName : Symbol(takeName, Decl(index.js, 11, 3)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +/** + * @type {number} + */ +var a = x.zip; +>a : Symbol(a, Decl(index.js, 22, 3)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +/** + * @type {number} + */ +var b = x.houseNumber; +>b : Symbol(b, Decl(index.js, 27, 3)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +const returnExemplar = () => x; +>returnExemplar : Symbol(returnExemplar, Decl(index.js, 29, 5)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +const needsExemplar = (_ = x) => void 0; +>needsExemplar : Symbol(needsExemplar, Decl(index.js, 30, 5)) +>_ : Symbol(_, Decl(index.js, 30, 23)) +>x : Symbol(x, Decl(index.js, 0, 5)) + +const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); +>expected : Symbol(expected, Decl(index.js, 32, 5)) + +/** + * + * @param {typeof returnExemplar} a + * @param {typeof needsExemplar} b + */ +function match(a, b) {} +>match : Symbol(match, Decl(index.js, 32, 186)) +>a : Symbol(a, Decl(index.js, 39, 15)) +>b : Symbol(b, Decl(index.js, 39, 17)) + +match(() => expected, (x = expected) => void 0); +>match : Symbol(match, Decl(index.js, 32, 186)) +>expected : Symbol(expected, Decl(index.js, 32, 5)) +>x : Symbol(x, Decl(index.js, 41, 23)) +>expected : Symbol(expected, Decl(index.js, 32, 5)) + +module.exports = x; +>module.exports : Symbol(x, Decl(index.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(x, Decl(index.js, 0, 5)) +>x : Symbol(x, Decl(index.js, 0, 5)) + diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff index 44f4224a15..46a9c331b0 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.symbols.diff @@ -67,136 +67,140 @@ ->x.middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71)) >x : Symbol(x, Decl(validate.ts, 0, 0)) ->middleInit : Symbol(x.middleInit, Decl(index.js, 1, 71)) -- --=== index.js === --const x = {}; + + === index.js === + const x = {}; ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --Object.defineProperty(x, "name", { value: "Charles", writable: true }); ++>x : Symbol(x, Decl(index.js, 0, 5)) + + Object.defineProperty(x, "name", { value: "Charles", writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"name" : Symbol(x.name, Decl(index.js, 0, 13)) -->value : Symbol(value, Decl(index.js, 1, 34)) -->writable : Symbol(writable, Decl(index.js, 1, 52)) -- --Object.defineProperty(x, "middleInit", { value: "H" }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >value : Symbol(value, Decl(index.js, 1, 34)) + >writable : Symbol(writable, Decl(index.js, 1, 52)) + + Object.defineProperty(x, "middleInit", { value: "H" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"middleInit" : Symbol(x.middleInit, Decl(index.js, 1, 71)) -->value : Symbol(value, Decl(index.js, 2, 40)) -- --Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >value : Symbol(value, Decl(index.js, 2, 40)) + + Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"lastName" : Symbol(x.lastName, Decl(index.js, 2, 55)) -->value : Symbol(value, Decl(index.js, 3, 38)) -->writable : Symbol(writable, Decl(index.js, 3, 54)) -- --Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >value : Symbol(value, Decl(index.js, 3, 38)) + >writable : Symbol(writable, Decl(index.js, 3, 54)) + + Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"zip" : Symbol(x.zip, Decl(index.js, 3, 74)) -->get : Symbol(get, Decl(index.js, 4, 33)) -->set : Symbol(set, Decl(index.js, 4, 57)) -->_ : Symbol(_, Decl(index.js, 4, 62)) -- --Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >get : Symbol(get, Decl(index.js, 4, 33)) + >set : Symbol(set, Decl(index.js, 4, 57)) + >_ : Symbol(_, Decl(index.js, 4, 62)) + + Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"houseNumber" : Symbol(x.houseNumber, Decl(index.js, 4, 83)) -->get : Symbol(get, Decl(index.js, 5, 41)) -- --Object.defineProperty(x, "zipStr", { ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + >get : Symbol(get, Decl(index.js, 5, 41)) + + Object.defineProperty(x, "zipStr", { ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->"zipStr" : Symbol(x.zipStr, Decl(index.js, 5, 68)) -- -- /** @param {string} str */ -- set(str) { -->set : Symbol(set, Decl(index.js, 6, 36)) -->str : Symbol(str, Decl(index.js, 8, 8)) -- -- this.zip = Number(str) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + /** @param {string} str */ + set(str) { +@@= skipped -125, +93 lines =@@ + >str : Symbol(str, Decl(index.js, 8, 8)) + + this.zip = Number(str) ->zip : Symbol(zip, Decl(index.js, 8, 14)) -->Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -->str : Symbol(str, Decl(index.js, 8, 8)) -- } --}); -- --/** -- * @param {{name: string}} named -- */ --function takeName(named) { return named.name; } -->takeName : Symbol(takeName, Decl(index.js, 11, 3)) -->named : Symbol(named, Decl(index.js, 16, 18)) -->named.name : Symbol(name, Decl(index.js, 14, 12)) -->named : Symbol(named, Decl(index.js, 16, 18)) -->name : Symbol(name, Decl(index.js, 14, 12)) -- --takeName(x); -->takeName : Symbol(takeName, Decl(index.js, 11, 3)) + >Number : Symbol(Number, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(index.js, 8, 8)) + } +@@= skipped -18, +17 lines =@@ + + takeName(x); + >takeName : Symbol(takeName, Decl(index.js, 11, 3)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --/** -- * @type {number} -- */ --var a = x.zip; -->a : Symbol(a, Decl(index.js, 22, 3)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + /** + * @type {number} + */ + var a = x.zip; + >a : Symbol(a, Decl(index.js, 22, 3)) ->x.zip : Symbol(x.zip, Decl(index.js, 3, 74)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->zip : Symbol(x.zip, Decl(index.js, 3, 74)) -- --/** -- * @type {number} -- */ --var b = x.houseNumber; -->b : Symbol(b, Decl(index.js, 27, 3)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + /** + * @type {number} + */ + var b = x.houseNumber; + >b : Symbol(b, Decl(index.js, 27, 3)) ->x.houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ->houseNumber : Symbol(x.houseNumber, Decl(index.js, 4, 83)) -- --const returnExemplar = () => x; -->returnExemplar : Symbol(returnExemplar, Decl(index.js, 29, 5)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + const returnExemplar = () => x; + >returnExemplar : Symbol(returnExemplar, Decl(index.js, 29, 5)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --const needsExemplar = (_ = x) => void 0; -->needsExemplar : Symbol(needsExemplar, Decl(index.js, 30, 5)) -->_ : Symbol(_, Decl(index.js, 30, 23)) ++>x : Symbol(x, Decl(index.js, 0, 5)) + + const needsExemplar = (_ = x) => void 0; + >needsExemplar : Symbol(needsExemplar, Decl(index.js, 30, 5)) + >_ : Symbol(_, Decl(index.js, 30, 23)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) -- --const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); -->expected : Symbol(expected, Decl(index.js, 32, 5)) -- --/** -- * -- * @param {typeof returnExemplar} a -- * @param {typeof needsExemplar} b -- */ --function match(a, b) {} -->match : Symbol(match, Decl(index.js, 32, 186)) -->a : Symbol(a, Decl(index.js, 39, 15)) -->b : Symbol(b, Decl(index.js, 39, 17)) -- --match(() => expected, (x = expected) => void 0); -->match : Symbol(match, Decl(index.js, 32, 186)) -->expected : Symbol(expected, Decl(index.js, 32, 5)) -->x : Symbol(x, Decl(index.js, 41, 23)) -->expected : Symbol(expected, Decl(index.js, 32, 5)) -- --module.exports = x; ++>x : Symbol(x, Decl(index.js, 0, 5)) + + const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); + >expected : Symbol(expected, Decl(index.js, 32, 5)) +@@= skipped -49, +45 lines =@@ + >expected : Symbol(expected, Decl(index.js, 32, 5)) + + module.exports = x; ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(export=, Decl(index.js, 41, 48)) ->exports : Symbol(export=, Decl(index.js, 41, 48)) ->x : Symbol(x, Decl(index.js, 0, 5), Decl(index.js, 1, 22), Decl(index.js, 2, 22), Decl(index.js, 3, 22), Decl(index.js, 4, 22) ... and 2 more) ++>module.exports : Symbol(x, Decl(index.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(x, Decl(index.js, 0, 5)) ++>x : Symbol(x, Decl(index.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types index cf53736a27..c2033ef342 100644 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types @@ -3,84 +3,254 @@ === validate.ts === // Validate in TS as simple validations would usually be interpreted as more special assignments import x = require("./"); ->x : any +>x : {} x.name; >x.name : any ->x : any +>x : {} >name : any x.middleInit; >x.middleInit : any ->x : any +>x : {} >middleInit : any x.lastName; >x.lastName : any ->x : any +>x : {} >lastName : any x.zip; >x.zip : any ->x : any +>x : {} >zip : any x.houseNumber; >x.houseNumber : any ->x : any +>x : {} >houseNumber : any x.zipStr; >x.zipStr : any ->x : any +>x : {} >zipStr : any x.name = "Another"; >x.name = "Another" : "Another" >x.name : any ->x : any +>x : {} >name : any >"Another" : "Another" x.zip = 98123; >x.zip = 98123 : 98123 >x.zip : any ->x : any +>x : {} >zip : any >98123 : 98123 x.zipStr = "OK"; >x.zipStr = "OK" : "OK" >x.zipStr : any ->x : any +>x : {} >zipStr : any >"OK" : "OK" x.lastName = "should fail"; >x.lastName = "should fail" : "should fail" >x.lastName : any ->x : any +>x : {} >lastName : any >"should fail" : "should fail" x.houseNumber = 12; // should also fail >x.houseNumber = 12 : 12 >x.houseNumber : any ->x : any +>x : {} >houseNumber : any >12 : 12 x.zipStr = 12; // should fail >x.zipStr = 12 : 12 >x.zipStr : any ->x : any +>x : {} >zipStr : any >12 : 12 x.middleInit = "R"; // should also fail >x.middleInit = "R" : "R" >x.middleInit : any ->x : any +>x : {} >middleInit : any >"R" : "R" +=== index.js === +const x = {}; +>x : {} +>{} : {} + +Object.defineProperty(x, "name", { value: "Charles", writable: true }); +>Object.defineProperty(x, "name", { value: "Charles", writable: true }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"name" : "name" +>{ value: "Charles", writable: true } : { value: string; writable: true; } +>value : string +>"Charles" : "Charles" +>writable : true +>true : true + +Object.defineProperty(x, "middleInit", { value: "H" }); +>Object.defineProperty(x, "middleInit", { value: "H" }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"middleInit" : "middleInit" +>{ value: "H" } : { value: string; } +>value : string +>"H" : "H" + +Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); +>Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"lastName" : "lastName" +>{ value: "Smith", writable: false } : { value: string; writable: false; } +>value : string +>"Smith" : "Smith" +>writable : false +>false : false + +Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); +>Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"zip" : "zip" +>{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +>get : () => number +>98122 : 98122 +>set : (_: any) => void +>_ : any + +Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); +>Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"houseNumber" : "houseNumber" +>{ get() { return 21.75 } } : { get(): number; } +>get : () => number +>21.75 : 21.75 + +Object.defineProperty(x, "zipStr", { +>Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : {} +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>x : {} +>"zipStr" : "zipStr" +>{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } + + /** @param {string} str */ + set(str) { +>set : (str: string) => void +>str : string + + this.zip = Number(str) +>this.zip = Number(str) : number +>this.zip : any +>this : any +>zip : any +>Number(str) : number +>Number : NumberConstructor +>str : string + } +}); + +/** + * @param {{name: string}} named + */ +function takeName(named) { return named.name; } +>takeName : (named: { name: string; }) => string +>named : { name: string; } +>named.name : string +>named : { name: string; } +>name : string + +takeName(x); +>takeName(x) : string +>takeName : (named: { name: string; }) => string +>x : {} + +/** + * @type {number} + */ +var a = x.zip; +>a : number +>x.zip : any +>x : {} +>zip : any + +/** + * @type {number} + */ +var b = x.houseNumber; +>b : number +>x.houseNumber : any +>x : {} +>houseNumber : any + +const returnExemplar = () => x; +>returnExemplar : () => {} +>() => x : () => {} +>x : {} + +const needsExemplar = (_ = x) => void 0; +>needsExemplar : (_?: {}) => undefined +>(_ = x) => void 0 : (_?: {}) => undefined +>_ : {} +>x : {} +>void 0 : undefined +>0 : 0 + +const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); +>expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>(/** @type {*} */(null)) : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>(null) : any + +/** + * + * @param {typeof returnExemplar} a + * @param {typeof needsExemplar} b + */ +function match(a, b) {} +>match : (a: () => {}, b: (_?: {}) => undefined) => void +>a : () => {} +>b : (_?: {}) => undefined + +match(() => expected, (x = expected) => void 0); +>match(() => expected, (x = expected) => void 0) : void +>match : (a: () => {}, b: (_?: {}) => undefined) => void +>() => expected : () => { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>(x = expected) => void 0 : (x?: {} | undefined) => undefined +>x : {} | undefined +>expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +>void 0 : undefined +>0 : 0 + +module.exports = x; +>module.exports = x : {} +>module.exports : {} +>module : { readonly x: {}; } +>exports : {} +>x : {} + diff --git a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types.diff b/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types.diff deleted file mode 100644 index 06b8b08e67..0000000000 --- a/testdata/baselines/reference/submodule/conformance/checkObjectDefineProperty.types.diff +++ /dev/null @@ -1,290 +0,0 @@ ---- old.checkObjectDefineProperty.types -+++ new.checkObjectDefineProperty.types -@@= skipped -2, +2 lines =@@ - === validate.ts === - // Validate in TS as simple validations would usually be interpreted as more special assignments - import x = require("./"); -->x : typeof x -+>x : any - - x.name; -->x.name : string -->x : typeof x -->name : string -+>x.name : any -+>x : any -+>name : any - - x.middleInit; -->x.middleInit : string -->x : typeof x -->middleInit : string -+>x.middleInit : any -+>x : any -+>middleInit : any - - x.lastName; -->x.lastName : string -->x : typeof x -->lastName : string -+>x.lastName : any -+>x : any -+>lastName : any - - x.zip; -->x.zip : number -->x : typeof x -->zip : number -+>x.zip : any -+>x : any -+>zip : any - - x.houseNumber; -->x.houseNumber : number -->x : typeof x -->houseNumber : number -+>x.houseNumber : any -+>x : any -+>houseNumber : any - - x.zipStr; -->x.zipStr : string -->x : typeof x -->zipStr : string -+>x.zipStr : any -+>x : any -+>zipStr : any - - x.name = "Another"; - >x.name = "Another" : "Another" -->x.name : string -->x : typeof x -->name : string -+>x.name : any -+>x : any -+>name : any - >"Another" : "Another" - - x.zip = 98123; - >x.zip = 98123 : 98123 -->x.zip : number -->x : typeof x -->zip : number -+>x.zip : any -+>x : any -+>zip : any - >98123 : 98123 - - x.zipStr = "OK"; - >x.zipStr = "OK" : "OK" -->x.zipStr : string -->x : typeof x -->zipStr : string -+>x.zipStr : any -+>x : any -+>zipStr : any - >"OK" : "OK" - - x.lastName = "should fail"; - >x.lastName = "should fail" : "should fail" - >x.lastName : any -->x : typeof x -+>x : any - >lastName : any - >"should fail" : "should fail" - - x.houseNumber = 12; // should also fail - >x.houseNumber = 12 : 12 - >x.houseNumber : any -->x : typeof x -+>x : any - >houseNumber : any - >12 : 12 - - x.zipStr = 12; // should fail - >x.zipStr = 12 : 12 -->x.zipStr : string -->x : typeof x -->zipStr : string -+>x.zipStr : any -+>x : any -+>zipStr : any - >12 : 12 - - x.middleInit = "R"; // should also fail - >x.middleInit = "R" : "R" - >x.middleInit : any -->x : typeof x -+>x : any - >middleInit : any - >"R" : "R" -- --=== index.js === --const x = {}; -->x : typeof x -->{} : {} -- --Object.defineProperty(x, "name", { value: "Charles", writable: true }); -->Object.defineProperty(x, "name", { value: "Charles", writable: true }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"name" : "name" -->{ value: "Charles", writable: true } : { value: string; writable: true; } -->value : string -->"Charles" : "Charles" -->writable : true -->true : true -- --Object.defineProperty(x, "middleInit", { value: "H" }); -->Object.defineProperty(x, "middleInit", { value: "H" }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"middleInit" : "middleInit" -->{ value: "H" } : { value: string; } -->value : string -->"H" : "H" -- --Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); -->Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"lastName" : "lastName" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); -->Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"zip" : "zip" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); -->Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"houseNumber" : "houseNumber" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(x, "zipStr", { -->Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : typeof x -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->x : typeof x -->"zipStr" : "zipStr" -->{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.zip = Number(str) -->this.zip = Number(str) : number -->this.zip : any -->this : any -->zip : any -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); -- --/** -- * @param {{name: string}} named -- */ --function takeName(named) { return named.name; } -->takeName : (named: { name: string; }) => string -->named : { name: string; } -->named.name : string -->named : { name: string; } -->name : string -- --takeName(x); -->takeName(x) : string -->takeName : (named: { name: string; }) => string -->x : typeof x -- --/** -- * @type {number} -- */ --var a = x.zip; -->a : number -->x.zip : number -->x : typeof x -->zip : number -- --/** -- * @type {number} -- */ --var b = x.houseNumber; -->b : number -->x.houseNumber : number -->x : typeof x -->houseNumber : number -- --const returnExemplar = () => x; -->returnExemplar : () => typeof x -->() => x : () => typeof x -->x : typeof x -- --const needsExemplar = (_ = x) => void 0; -->needsExemplar : (_?: typeof x) => undefined -->(_ = x) => void 0 : (_?: typeof x) => undefined -->_ : typeof x -->x : typeof x -->void 0 : undefined -->0 : 0 -- --const expected = /** @type {{name: string, readonly middleInit: string, readonly lastName: string, zip: number, readonly houseNumber: number, zipStr: string}} */(/** @type {*} */(null)); -->expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->(/** @type {*} */(null)) : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->(null) : any -- --/** -- * -- * @param {typeof returnExemplar} a -- * @param {typeof needsExemplar} b -- */ --function match(a, b) {} -->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void -->a : () => typeof x -->b : (_?: typeof x) => undefined -- --match(() => expected, (x = expected) => void 0); -->match(() => expected, (x = expected) => void 0) : void -->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void -->() => expected : () => { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->(x = expected) => void 0 : (x?: typeof x | undefined) => undefined -->x : typeof x | undefined -->expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } -->void 0 : undefined -->0 : 0 -- --module.exports = x; -->module.exports = x : typeof x -->module.exports : typeof x -->module : { exports: typeof x; } -->exports : typeof x -->x : typeof x diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt index 8e0d93de69..b339a4e9ee 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.errors.txt @@ -1,10 +1,16 @@ -importer.js(1,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +importer.js(1,21): error TS2306: File 'mod1.js' is not a module. +mod1.js(2,23): error TS2304: Cannot find name 'exports'. +mod1.js(8,23): error TS2304: Cannot find name 'exports'. +mod1.js(11,23): error TS2304: Cannot find name 'exports'. +mod1.js(14,23): error TS2304: Cannot find name 'exports'. +mod1.js(15,23): error TS2304: Cannot find name 'exports'. +mod1.js(16,23): error TS2304: Cannot find name 'exports'. ==== importer.js (1 errors) ==== const mod = require("./mod1"); ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +!!! error TS2306: File 'mod1.js' is not a module. mod.thing; mod.other; mod.prop; @@ -20,21 +26,33 @@ importer.js(1,21): error TS7016: Could not find a declaration file for module '. mod.bad2 = 0; mod.bad3 = 0; -==== mod1.js (0 errors) ==== +==== mod1.js (6 errors) ==== const obj = { value: 42, writable: true }; Object.defineProperty(exports, "thing", obj); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. /** * @type {string} */ let str = /** @type {string} */("other"); Object.defineProperty(exports, str, { value: 42, writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. const propName = "prop" Object.defineProperty(exports, propName, { value: 42, writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "bad1", { }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. Object.defineProperty(exports, "bad3", { writable: true }); + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols index 1cd432e219..a395d22191 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols @@ -42,3 +42,59 @@ mod.bad2 = 0; mod.bad3 = 0; >mod : Symbol(mod, Decl(importer.js, 0, 5)) +=== mod1.js === +const obj = { value: 42, writable: true }; +>obj : Symbol(obj, Decl(mod1.js, 0, 5)) +>value : Symbol(value, Decl(mod1.js, 0, 13)) +>writable : Symbol(writable, Decl(mod1.js, 0, 24)) + +Object.defineProperty(exports, "thing", obj); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(mod1.js, 0, 5)) + +/** + * @type {string} + */ +let str = /** @type {string} */("other"); +>str : Symbol(str, Decl(mod1.js, 6, 3)) + +Object.defineProperty(exports, str, { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>str : Symbol(str, Decl(mod1.js, 6, 3)) +>value : Symbol(value, Decl(mod1.js, 7, 37)) +>writable : Symbol(writable, Decl(mod1.js, 7, 48)) + +const propName = "prop" +>propName : Symbol(propName, Decl(mod1.js, 9, 5)) + +Object.defineProperty(exports, propName, { value: 42, writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>propName : Symbol(propName, Decl(mod1.js, 9, 5)) +>value : Symbol(value, Decl(mod1.js, 10, 42)) +>writable : Symbol(writable, Decl(mod1.js, 10, 53)) + + +Object.defineProperty(exports, "bad1", { }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + +Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>get : Symbol(get, Decl(mod1.js, 14, 40)) +>value : Symbol(value, Decl(mod1.js, 14, 61)) + +Object.defineProperty(exports, "bad3", { writable: true }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>writable : Symbol(writable, Decl(mod1.js, 15, 40)) + diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff index b4c513b038..238be46b00 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.symbols.diff @@ -56,69 +56,77 @@ ->mod.bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77)) >mod : Symbol(mod, Decl(importer.js, 0, 5)) ->bad3 : Symbol(mod.bad3, Decl(mod1.js, 14, 77)) -- --=== mod1.js === --const obj = { value: 42, writable: true }; -->obj : Symbol(obj, Decl(mod1.js, 0, 5)) -->value : Symbol(value, Decl(mod1.js, 0, 13)) -->writable : Symbol(writable, Decl(mod1.js, 0, 24)) -- --Object.defineProperty(exports, "thing", obj); + + === mod1.js === + const obj = { value: 42, writable: true }; +@@= skipped -21, +15 lines =@@ + >writable : Symbol(writable, Decl(mod1.js, 0, 24)) + + Object.defineProperty(exports, "thing", obj); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"thing" : Symbol(thing, Decl(mod1.js, 0, 42)) -->obj : Symbol(obj, Decl(mod1.js, 0, 5)) -- --/** -- * @type {string} -- */ --let str = /** @type {string} */("other"); -->str : Symbol(str, Decl(mod1.js, 6, 3)) -- --Object.defineProperty(exports, str, { value: 42, writable: true }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >obj : Symbol(obj, Decl(mod1.js, 0, 5)) + + /** +@@= skipped -14, +12 lines =@@ + >str : Symbol(str, Decl(mod1.js, 6, 3)) + + Object.defineProperty(exports, str, { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->str : Symbol(str, Decl(mod1.js, 6, 3)) -->value : Symbol(value, Decl(mod1.js, 7, 37)) -->writable : Symbol(writable, Decl(mod1.js, 7, 48)) -- --const propName = "prop" -->propName : Symbol(propName, Decl(mod1.js, 9, 5)) -- --Object.defineProperty(exports, propName, { value: 42, writable: true }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >str : Symbol(str, Decl(mod1.js, 6, 3)) + >value : Symbol(value, Decl(mod1.js, 7, 37)) + >writable : Symbol(writable, Decl(mod1.js, 7, 48)) +@@= skipped -12, +11 lines =@@ + >propName : Symbol(propName, Decl(mod1.js, 9, 5)) + + Object.defineProperty(exports, propName, { value: 42, writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->propName : Symbol(propName, Decl(mod1.js, 9, 5)) -->value : Symbol(value, Decl(mod1.js, 10, 42)) -->writable : Symbol(writable, Decl(mod1.js, 10, 53)) -- -- --Object.defineProperty(exports, "bad1", { }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >propName : Symbol(propName, Decl(mod1.js, 9, 5)) + >value : Symbol(value, Decl(mod1.js, 10, 42)) + >writable : Symbol(writable, Decl(mod1.js, 10, 53)) + + + Object.defineProperty(exports, "bad1", { }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"bad1" : Symbol(bad1, Decl(mod1.js, 10, 72)) -- --Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + + Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"bad2" : Symbol(bad2, Decl(mod1.js, 13, 44)) -->get : Symbol(get, Decl(mod1.js, 14, 40)) -->value : Symbol(value, Decl(mod1.js, 14, 61)) -- --Object.defineProperty(exports, "bad3", { writable: true }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >get : Symbol(get, Decl(mod1.js, 14, 40)) + >value : Symbol(value, Decl(mod1.js, 14, 61)) + + Object.defineProperty(exports, "bad3", { writable: true }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ->"bad3" : Symbol(bad3, Decl(mod1.js, 14, 77)) -->writable : Symbol(writable, Decl(mod1.js, 15, 40)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >writable : Symbol(writable, Decl(mod1.js, 15, 40)) diff --git a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types index a465cf600e..948015e68b 100644 --- a/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types +++ b/testdata/baselines/reference/submodule/conformance/checkOtherObjectAssignProperty.types @@ -80,3 +80,93 @@ mod.bad3 = 0; >bad3 : any >0 : 0 +=== mod1.js === +const obj = { value: 42, writable: true }; +>obj : { value: number; writable: boolean; } +>{ value: 42, writable: true } : { value: number; writable: boolean; } +>value : number +>42 : 42 +>writable : boolean +>true : true + +Object.defineProperty(exports, "thing", obj); +>Object.defineProperty(exports, "thing", obj) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"thing" : "thing" +>obj : { value: number; writable: boolean; } + +/** + * @type {string} + */ +let str = /** @type {string} */("other"); +>str : string +>("other") : string +>"other" : "other" + +Object.defineProperty(exports, str, { value: 42, writable: true }); +>Object.defineProperty(exports, str, { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>str : string +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + +const propName = "prop" +>propName : "prop" +>"prop" : "prop" + +Object.defineProperty(exports, propName, { value: 42, writable: true }); +>Object.defineProperty(exports, propName, { value: 42, writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>propName : "prop" +>{ value: 42, writable: true } : { value: number; writable: true; } +>value : number +>42 : 42 +>writable : true +>true : true + + +Object.defineProperty(exports, "bad1", { }); +>Object.defineProperty(exports, "bad1", { }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"bad1" : "bad1" +>{ } : {} + +Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); +>Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"bad2" : "bad2" +>{ get() { return 12 }, value: "no" } : { get(): number; value: string; } +>get : () => number +>12 : 12 +>value : string +>"no" : "no" + +Object.defineProperty(exports, "bad3", { writable: true }); +>Object.defineProperty(exports, "bad3", { writable: true }) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>exports : any +>"bad3" : "bad3" +>{ writable: true } : { writable: true; } +>writable : true +>true : true + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt new file mode 100644 index 0000000000..9702659e53 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.errors.txt @@ -0,0 +1,27 @@ +bug43713.js(1,9): error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. +commonJSAliasedExport.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. + + +==== bug43713.js (1 errors) ==== + const { funky } = require('./commonJSAliasedExport'); + ~~~~~ +!!! error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. + /** @type {boolean} */ + var diddy + var diddy = funky(1) + + +==== commonJSAliasedExport.js (2 errors) ==== + const donkey = (ast) => ast; + + function funky(declaration) { + return false; + } + module.exports = donkey; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.funky = funky; + ~~~~~ +!!! error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols index b7748b291e..8c3b8e0421 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols @@ -4,6 +4,7 @@ const { funky } = require('./commonJSAliasedExport'); >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) >require : Symbol(require) +>'./commonJSAliasedExport' : Symbol("commonJSAliasedExport", Decl(commonJSAliasedExport.js, 0, 0)) /** @type {boolean} */ var diddy @@ -14,3 +15,27 @@ var diddy = funky(1) >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) +=== commonJSAliasedExport.js === +const donkey = (ast) => ast; +>donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) +>ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) + +function funky(declaration) { +>funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) +>declaration : Symbol(declaration, Decl(commonJSAliasedExport.js, 2, 15)) + + return false; +} +module.exports = donkey; +>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + +module.exports.funky = funky; +>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>module : Symbol(module.exports) +>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) +>funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff index 033029b962..57e789428e 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.symbols.diff @@ -1,40 +1,24 @@ --- old.commonJSAliasedExport.symbols +++ new.commonJSAliasedExport.symbols -@@= skipped -3, +3 lines =@@ - const { funky } = require('./commonJSAliasedExport'); - >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) - >require : Symbol(require) -->'./commonJSAliasedExport' : Symbol("commonJSAliasedExport", Decl(commonJSAliasedExport.js, 0, 0)) - - /** @type {boolean} */ - var diddy -@@= skipped -10, +9 lines =@@ - >diddy : Symbol(diddy, Decl(bug43713.js, 2, 3), Decl(bug43713.js, 3, 3)) - >funky : Symbol(funky, Decl(bug43713.js, 0, 7)) - -- --=== commonJSAliasedExport.js === --const donkey = (ast) => ast; -->donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) -->ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) -->ast : Symbol(ast, Decl(commonJSAliasedExport.js, 0, 16)) -- --function funky(declaration) { -->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) -->declaration : Symbol(declaration, Decl(commonJSAliasedExport.js, 2, 15)) -- -- return false; --} --module.exports = donkey; +@@= skipped -27, +27 lines =@@ + return false; + } + module.exports = donkey; ->module.exports : Symbol(module.exports, Decl(commonJSAliasedExport.js, 0, 0)) ->module : Symbol(export=, Decl(commonJSAliasedExport.js, 4, 1)) ->exports : Symbol(export=, Decl(commonJSAliasedExport.js, 4, 1)) -->donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) -- --module.exports.funky = funky; ++>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + >donkey : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + + module.exports.funky = funky; ->module.exports.funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) ->module.exports : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) ->module : Symbol(module, Decl(commonJSAliasedExport.js, 4, 1)) ->exports : Symbol(module.exports, Decl(commonJSAliasedExport.js, 0, 0)) ->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 5, 24)) -->funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) ++>module.exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) ++>module : Symbol(module.exports) ++>exports : Symbol(donkey, Decl(commonJSAliasedExport.js, 0, 5)) + >funky : Symbol(funky, Decl(commonJSAliasedExport.js, 0, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types index cc0fc9ebc6..b4d9bc810d 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSAliasedExport.types @@ -3,7 +3,7 @@ === bug43713.js === const { funky } = require('./commonJSAliasedExport'); >funky : any ->require('./commonJSAliasedExport') : any +>require('./commonJSAliasedExport') : (ast: any) => any >require : any >'./commonJSAliasedExport' : "./commonJSAliasedExport" @@ -18,3 +18,33 @@ var diddy = funky(1) >1 : 1 +=== commonJSAliasedExport.js === +const donkey = (ast) => ast; +>donkey : (ast: any) => any +>(ast) => ast : (ast: any) => any +>ast : any +>ast : any + +function funky(declaration) { +>funky : (declaration: any) => boolean +>declaration : any + + return false; +>false : false +} +module.exports = donkey; +>module.exports = donkey : (ast: any) => any +>module.exports : (ast: any) => any +>module : { readonly donkey: (ast: any) => any; } +>exports : (ast: any) => any +>donkey : (ast: any) => any + +module.exports.funky = funky; +>module.exports.funky = funky : (declaration: any) => boolean +>module.exports.funky : any +>module.exports : (ast: any) => any +>module : { readonly donkey: (ast: any) => any; } +>exports : (ast: any) => any +>funky : any +>funky : (declaration: any) => boolean + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols index 7dbfb5c117..a9258f816a 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols +++ b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols @@ -3,8 +3,37 @@ === main.js === const { hardline } = require('./second').nested; >hardline : Symbol(hardline, Decl(main.js, 0, 7)) +>require('./second').nested : Symbol(nested, Decl(second.js, 0, 18)) >require : Symbol(require) +>nested : Symbol(nested, Decl(second.js, 0, 18)) hardline >hardline : Symbol(hardline, Decl(main.js, 0, 7)) +=== first.js === +const hardline = { type: "hard" } +>hardline : Symbol(hardline, Decl(first.js, 0, 5)) +>type : Symbol(type, Decl(first.js, 0, 18)) + +module.exports = { +>module.exports : Symbol(export=, Decl(first.js, 0, 33)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(first.js, 0, 33)) + + hardline +>hardline : Symbol(hardline, Decl(first.js, 1, 18)) +} + + +=== second.js === +module.exports = { +>module.exports : Symbol(export=, Decl(second.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(second.js, 0, 0)) + + nested: require('./first') +>nested : Symbol(nested, Decl(second.js, 0, 18)) +>require : Symbol(require) + +}; + diff --git a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff index bf249a8752..bd49fde05b 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/commonJSReexport.symbols.diff @@ -1,41 +1,39 @@ --- old.commonJSReexport.symbols +++ new.commonJSReexport.symbols -@@= skipped -2, +2 lines =@@ - === main.js === - const { hardline } = require('./second').nested; +@@= skipped -4, +4 lines =@@ >hardline : Symbol(hardline, Decl(main.js, 0, 7)) -->require('./second').nested : Symbol(nested, Decl(second.js, 0, 18)) + >require('./second').nested : Symbol(nested, Decl(second.js, 0, 18)) >require : Symbol(require) ->'./second' : Symbol("second", Decl(second.js, 0, 0)) -->nested : Symbol(nested, Decl(second.js, 0, 18)) + >nested : Symbol(nested, Decl(second.js, 0, 18)) hardline - >hardline : Symbol(hardline, Decl(main.js, 0, 7)) -- --=== first.js === --const hardline = { type: "hard" } -->hardline : Symbol(hardline, Decl(first.js, 0, 5)) -->type : Symbol(type, Decl(first.js, 0, 18)) -- --module.exports = { +@@= skipped -12, +11 lines =@@ + >type : Symbol(type, Decl(first.js, 0, 18)) + + module.exports = { ->module.exports : Symbol(module.exports, Decl(first.js, 0, 0)) ->module : Symbol(module, Decl(first.js, 0, 33)) ->exports : Symbol(module.exports, Decl(first.js, 0, 0)) -- -- hardline -->hardline : Symbol(hardline, Decl(first.js, 1, 18)) --} -- -- --=== second.js === --module.exports = { ++>module.exports : Symbol(export=, Decl(first.js, 0, 33)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(first.js, 0, 33)) + + hardline + >hardline : Symbol(hardline, Decl(first.js, 1, 18)) +@@= skipped -11, +11 lines =@@ + + === second.js === + module.exports = { ->module.exports : Symbol(module.exports, Decl(second.js, 0, 0)) ->module : Symbol(export=, Decl(second.js, 0, 0)) -->exports : Symbol(export=, Decl(second.js, 0, 0)) -- -- nested: require('./first') -->nested : Symbol(nested, Decl(second.js, 0, 18)) -->require : Symbol(require) ++>module.exports : Symbol(export=, Decl(second.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(second.js, 0, 0)) + + nested: require('./first') + >nested : Symbol(nested, Decl(second.js, 0, 18)) + >require : Symbol(require) ->'./first' : Symbol("first", Decl(first.js, 0, 0)) -- --}; + + }; diff --git a/testdata/baselines/reference/submodule/conformance/commonJSReexport.types b/testdata/baselines/reference/submodule/conformance/commonJSReexport.types index 5a6d596276..396924551e 100644 --- a/testdata/baselines/reference/submodule/conformance/commonJSReexport.types +++ b/testdata/baselines/reference/submodule/conformance/commonJSReexport.types @@ -2,13 +2,48 @@ === main.js === const { hardline } = require('./second').nested; ->hardline : any ->require('./second').nested : any ->require('./second') : any +>hardline : { type: string; } +>require('./second').nested : { hardline: { type: string; }; } +>require('./second') : { nested: { hardline: { type: string; }; }; } >require : any >'./second' : "./second" ->nested : any +>nested : { hardline: { type: string; }; } hardline ->hardline : any +>hardline : { type: string; } + +=== first.js === +const hardline = { type: "hard" } +>hardline : { type: string; } +>{ type: "hard" } : { type: string; } +>type : string +>"hard" : "hard" + +module.exports = { +>module.exports = { hardline} : { hardline: { type: string; }; } +>module.exports : { hardline: { type: string; }; } +>module : { "export=": { hardline: { type: string; }; }; } +>exports : { hardline: { type: string; }; } +>{ hardline} : { hardline: { type: string; }; } + + hardline +>hardline : { type: string; } +} + + +=== second.js === +module.exports = { +>module.exports = { nested: require('./first')} : { nested: { hardline: { type: string; }; }; } +>module.exports : { nested: { hardline: { type: string; }; }; } +>module : { "export=": { nested: { hardline: { type: string; }; }; }; } +>exports : { nested: { hardline: { type: string; }; }; } +>{ nested: require('./first')} : { nested: { hardline: { type: string; }; }; } + + nested: require('./first') +>nested : { hardline: { type: string; }; } +>require('./first') : { hardline: { type: string; }; } +>require : any +>'./first' : "./first" + +}; diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt new file mode 100644 index 0000000000..b02d019f6c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt @@ -0,0 +1,15 @@ +main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + +==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + +==== package.json (0 errors) ==== + {"type": "module"} +==== dir/package.json (0 errors) ==== + {"type": "commonjs"} +==== dir/native.d.node.ts (0 errors) ==== + export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff index 205b4b3208..3a70da5bf4 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt.diff @@ -2,18 +2,14 @@ +++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).errors.txt @@= skipped -0, +0 lines =@@ -main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- -- --==== main.ts (1 errors) ==== -- import mod = require("./dir/native.node"); -- ~~~~~~~~~~~~~~~~~~~ ++main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + + ==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ -!!! error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- mod.doNativeThing("good"); -- --==== package.json (0 errors) ==== -- {"type": "module"} --==== dir/package.json (0 errors) ==== -- {"type": "commonjs"} --==== dir/native.d.node.ts (0 errors) ==== -- export function doNativeThing(flag: string): unknown; -+ \ No newline at end of file ++!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + + ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols index f95e518bed..ea430da48c 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols @@ -5,12 +5,5 @@ import mod = require("./dir/native.node"); >mod : Symbol(mod, Decl(main.ts, 0, 0)) mod.doNativeThing("good"); ->mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) >mod : Symbol(mod, Decl(main.ts, 0, 0)) ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) ->flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols.diff deleted file mode 100644 index d15932c4c5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).symbols -@@= skipped -4, +4 lines =@@ - >mod : Symbol(mod, Decl(main.ts, 0, 0)) - - mod.doNativeThing("good"); -+>mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - >mod : Symbol(mod, Decl(main.ts, 0, 0)) -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+>flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types index 96373ebb9b..8beb10bd23 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types @@ -2,17 +2,12 @@ === main.ts === import mod = require("./dir/native.node"); ->mod : typeof mod +>mod : any mod.doNativeThing("good"); ->mod.doNativeThing("good") : unknown ->mod.doNativeThing : (flag: string) => unknown ->mod : typeof mod ->doNativeThing : (flag: string) => unknown +>mod.doNativeThing("good") : any +>mod.doNativeThing : any +>mod : any +>doNativeThing : any >"good" : "good" -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : (flag: string) => unknown ->flag : string - diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types.diff deleted file mode 100644 index eb5b55b3e2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node18).types -@@= skipped -1, +1 lines =@@ - - === main.ts === - import mod = require("./dir/native.node"); -->mod : any -+>mod : typeof mod - - mod.doNativeThing("good"); -->mod.doNativeThing("good") : any -->mod.doNativeThing : any -->mod : any -->doNativeThing : any -+>mod.doNativeThing("good") : unknown -+>mod.doNativeThing : (flag: string) => unknown -+>mod : typeof mod -+>doNativeThing : (flag: string) => unknown - >"good" : "good" -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : (flag: string) => unknown -+>flag : string diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt new file mode 100644 index 0000000000..b02d019f6c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt @@ -0,0 +1,15 @@ +main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + +==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + +==== package.json (0 errors) ==== + {"type": "module"} +==== dir/package.json (0 errors) ==== + {"type": "commonjs"} +==== dir/native.d.node.ts (0 errors) ==== + export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff index 6075245c91..5ab7ae5bd1 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt.diff @@ -2,18 +2,14 @@ +++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).errors.txt @@= skipped -0, +0 lines =@@ -main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- -- --==== main.ts (1 errors) ==== -- import mod = require("./dir/native.node"); -- ~~~~~~~~~~~~~~~~~~~ ++main.ts(1,22): error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + + + ==== main.ts (1 errors) ==== + import mod = require("./dir/native.node"); + ~~~~~~~~~~~~~~~~~~~ -!!! error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -- mod.doNativeThing("good"); -- --==== package.json (0 errors) ==== -- {"type": "module"} --==== dir/package.json (0 errors) ==== -- {"type": "commonjs"} --==== dir/native.d.node.ts (0 errors) ==== -- export function doNativeThing(flag: string): unknown; -+ \ No newline at end of file ++!!! error TS2307: Cannot find module './dir/native.node' or its corresponding type declarations. + mod.doNativeThing("good"); + + ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols index f95e518bed..ea430da48c 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols @@ -5,12 +5,5 @@ import mod = require("./dir/native.node"); >mod : Symbol(mod, Decl(main.ts, 0, 0)) mod.doNativeThing("good"); ->mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) >mod : Symbol(mod, Decl(main.ts, 0, 0)) ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) ->flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols.diff deleted file mode 100644 index b5e5f9676c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).symbols -@@= skipped -4, +4 lines =@@ - >mod : Symbol(mod, Decl(main.ts, 0, 0)) - - mod.doNativeThing("good"); -+>mod.doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) - >mod : Symbol(mod, Decl(main.ts, 0, 0)) -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : Symbol(doNativeThing, Decl(native.d.node.ts, 0, 0)) -+>flag : Symbol(flag, Decl(native.d.node.ts, 0, 30)) diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types index 96373ebb9b..8beb10bd23 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types @@ -2,17 +2,12 @@ === main.ts === import mod = require("./dir/native.node"); ->mod : typeof mod +>mod : any mod.doNativeThing("good"); ->mod.doNativeThing("good") : unknown ->mod.doNativeThing : (flag: string) => unknown ->mod : typeof mod ->doNativeThing : (flag: string) => unknown +>mod.doNativeThing("good") : any +>mod.doNativeThing : any +>mod : any +>doNativeThing : any >"good" : "good" -=== dir/native.d.node.ts === -export function doNativeThing(flag: string): unknown; ->doNativeThing : (flag: string) => unknown ->flag : string - diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types.diff deleted file mode 100644 index afde6f3ec6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=nodenext).types -@@= skipped -1, +1 lines =@@ - - === main.ts === - import mod = require("./dir/native.node"); -->mod : any -+>mod : typeof mod - - mod.doNativeThing("good"); -->mod.doNativeThing("good") : any -->mod.doNativeThing : any -->mod : any -->doNativeThing : any -+>mod.doNativeThing("good") : unknown -+>mod.doNativeThing : (flag: string) => unknown -+>mod : typeof mod -+>doNativeThing : (flag: string) => unknown - >"good" : "good" -+ -+=== dir/native.d.node.ts === -+export function doNativeThing(flag: string): unknown; -+>doNativeThing : (flag: string) => unknown -+>flag : string diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols index e5a0af6347..bd1cc110ec 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols @@ -4,6 +4,7 @@ const Bar = require("./bar"); >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) >require : Symbol(require) +>"./bar" : Symbol("bar", Decl(bar.js, 0, 0)) const Strings = { >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) @@ -31,3 +32,13 @@ module.exports.Strings = Strings; >exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) +=== bar.js === +class Bar {} +>Bar : Symbol(Bar, Decl(bar.js, 0, 0)) + +module.exports = Bar; +>module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(Bar, Decl(bar.js, 0, 0)) +>Bar : Symbol(Bar, Decl(bar.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff index 48e1df3f49..92f53b9b9c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.symbols.diff @@ -1,14 +1,6 @@ --- old.jsDeclarationsClassExtendsVisibility.symbols +++ new.jsDeclarationsClassExtendsVisibility.symbols -@@= skipped -3, +3 lines =@@ - const Bar = require("./bar"); - >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) - >require : Symbol(require) -->"./bar" : Symbol("bar", Decl(bar.js, 0, 0)) - - const Strings = { - >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) -@@= skipped -17, +16 lines =@@ +@@= skipped -20, +20 lines =@@ >Bar : Symbol(Bar, Decl(cls.js, 0, 5)) module.exports = Foo; @@ -30,13 +22,16 @@ +>module : Symbol(module.exports) +>exports : Symbol(Foo, Decl(cls.js, 4, 2)) >Strings : Symbol(Strings, Decl(cls.js, 1, 5)) -- --=== bar.js === --class Bar {} -->Bar : Symbol(Bar, Decl(bar.js, 0, 0)) -- --module.exports = Bar; + + === bar.js === +@@= skipped -18, +16 lines =@@ + >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) + + module.exports = Bar; ->module.exports : Symbol(module.exports, Decl(bar.js, 0, 0)) ->module : Symbol(export=, Decl(bar.js, 0, 12)) ->exports : Symbol(export=, Decl(bar.js, 0, 12)) -->Bar : Symbol(Bar, Decl(bar.js, 0, 0)) ++>module.exports : Symbol(Bar, Decl(bar.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(Bar, Decl(bar.js, 0, 0)) + >Bar : Symbol(Bar, Decl(bar.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types index 0ee6696aa2..d2474b76c9 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsClassExtendsVisibility.types @@ -2,8 +2,8 @@ === cls.js === const Bar = require("./bar"); ->Bar : any ->require("./bar") : any +>Bar : typeof Bar +>require("./bar") : typeof Bar >require : any >"./bar" : "./bar" @@ -22,7 +22,7 @@ const Strings = { }; class Foo extends Bar {} >Foo : Foo ->Bar : any +>Bar : Bar module.exports = Foo; >module.exports = Foo : typeof Foo @@ -40,3 +40,14 @@ module.exports.Strings = Strings; >Strings : any >Strings : { a: string; b: string; } +=== bar.js === +class Bar {} +>Bar : Bar + +module.exports = Bar; +>module.exports = Bar : typeof Bar +>module.exports : typeof Bar +>module : { Bar: typeof Bar; } +>exports : typeof Bar +>Bar : typeof Bar + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols index 5fa419d304..c23777b7c5 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols @@ -4,7 +4,9 @@ 'use strict'; const Thing = require('./thing').Thing >Thing : Symbol(Thing, Decl(reexport.js, 1, 5)) +>require('./thing').Thing : Symbol(Thing, Decl(thing.js, 2, 18)) >require : Symbol(require) +>Thing : Symbol(Thing, Decl(thing.js, 2, 18)) module.exports = { Thing } >module.exports : Symbol(export=, Decl(reexport.js, 1, 38)) @@ -12,3 +14,14 @@ module.exports = { Thing } >exports : Symbol(export=, Decl(reexport.js, 1, 38)) >Thing : Symbol(Thing, Decl(reexport.js, 2, 18)) +=== thing.js === +'use strict'; +class Thing {} +>Thing : Symbol(Thing, Decl(thing.js, 0, 13)) + +module.exports = { Thing } +>module.exports : Symbol(export=, Decl(thing.js, 1, 14)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(thing.js, 1, 14)) +>Thing : Symbol(Thing, Decl(thing.js, 2, 18)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff index 794862eb4a..af6fef4536 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.symbols.diff @@ -1,13 +1,11 @@ --- old.jsDeclarationsCommonjsRelativePath.symbols +++ new.jsDeclarationsCommonjsRelativePath.symbols -@@= skipped -3, +3 lines =@@ - 'use strict'; - const Thing = require('./thing').Thing +@@= skipped -5, +5 lines =@@ >Thing : Symbol(Thing, Decl(reexport.js, 1, 5)) -->require('./thing').Thing : Symbol(Thing, Decl(thing.js, 2, 18)) + >require('./thing').Thing : Symbol(Thing, Decl(thing.js, 2, 18)) >require : Symbol(require) ->'./thing' : Symbol("thing", Decl(thing.js, 0, 0)) -->Thing : Symbol(Thing, Decl(thing.js, 2, 18)) + >Thing : Symbol(Thing, Decl(thing.js, 2, 18)) module.exports = { Thing } ->module.exports : Symbol(module.exports, Decl(reexport.js, 0, 0)) @@ -17,14 +15,16 @@ +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(reexport.js, 1, 38)) >Thing : Symbol(Thing, Decl(reexport.js, 2, 18)) -- --=== thing.js === --'use strict'; --class Thing {} -->Thing : Symbol(Thing, Decl(thing.js, 0, 13)) -- --module.exports = { Thing } + + === thing.js === +@@= skipped -15, +14 lines =@@ + >Thing : Symbol(Thing, Decl(thing.js, 0, 13)) + + module.exports = { Thing } ->module.exports : Symbol(module.exports, Decl(thing.js, 0, 0)) ->module : Symbol(module, Decl(thing.js, 1, 14)) ->exports : Symbol(module.exports, Decl(thing.js, 0, 0)) -->Thing : Symbol(Thing, Decl(thing.js, 2, 18)) ++>module.exports : Symbol(export=, Decl(thing.js, 1, 14)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(thing.js, 1, 14)) + >Thing : Symbol(Thing, Decl(thing.js, 2, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types index a0355d1242..592e8c0187 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsCommonjsRelativePath.types @@ -5,18 +5,33 @@ >'use strict' : "use strict" const Thing = require('./thing').Thing ->Thing : any ->require('./thing').Thing : any ->require('./thing') : any +>Thing : typeof Thing +>require('./thing').Thing : typeof Thing +>require('./thing') : { Thing: typeof Thing; } >require : any >'./thing' : "./thing" ->Thing : any +>Thing : typeof Thing module.exports = { Thing } ->module.exports = { Thing } : { Thing: any; } ->module.exports : { Thing: any; } ->module : { "export=": { Thing: any; }; } ->exports : { Thing: any; } ->{ Thing } : { Thing: any; } ->Thing : any +>module.exports = { Thing } : { Thing: typeof Thing; } +>module.exports : { Thing: typeof Thing; } +>module : { "export=": { Thing: typeof Thing; }; } +>exports : { Thing: typeof Thing; } +>{ Thing } : { Thing: typeof Thing; } +>Thing : typeof Thing + +=== thing.js === +'use strict'; +>'use strict' : "use strict" + +class Thing {} +>Thing : Thing + +module.exports = { Thing } +>module.exports = { Thing } : { Thing: typeof Thing; } +>module.exports : { Thing: typeof Thing; } +>module : { "export=": { Thing: typeof Thing; }; } +>exports : { Thing: typeof Thing; } +>{ Thing } : { Thing: typeof Thing; } +>Thing : typeof Thing diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols index aa6482c795..a7775109f2 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols @@ -4,6 +4,7 @@ const Obj = require("./obj"); >Obj : Symbol(Obj, Decl(index.js, 0, 5)) >require : Symbol(require) +>"./obj" : Symbol("obj", Decl(obj.js, 0, 0)) class Container { >Container : Symbol(Container, Decl(index.js, 0, 29)) @@ -23,3 +24,17 @@ module.exports = Container; >exports : Symbol(Container, Decl(index.js, 0, 29)) >Container : Symbol(Container, Decl(index.js, 0, 29)) +=== obj.js === +module.exports = class Obj { +>module.exports : Symbol(Obj, Decl(obj.js, 0, 16)) +>module : Symbol(module.exports) +>exports : Symbol(Obj, Decl(obj.js, 0, 16)) +>Obj : Symbol(Obj, Decl(obj.js, 0, 16)) + + constructor() { + this.x = 12; +>this.x : Symbol(x, Decl(obj.js, 1, 19)) +>this : Symbol(Obj, Decl(obj.js, 0, 16)) +>x : Symbol(x, Decl(obj.js, 1, 19)) + } +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff index ec67a8c03f..63f91e6644 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.symbols.diff @@ -1,13 +1,6 @@ --- old.jsDeclarationsExportAssignedVisibility.symbols +++ new.jsDeclarationsExportAssignedVisibility.symbols -@@= skipped -3, +3 lines =@@ - const Obj = require("./obj"); - >Obj : Symbol(Obj, Decl(index.js, 0, 5)) - >require : Symbol(require) -->"./obj" : Symbol("obj", Decl(obj.js, 0, 0)) - - class Container { - >Container : Symbol(Container, Decl(index.js, 0, 29)) +@@= skipped -10, +10 lines =@@ constructor() { this.usage = new Obj(); @@ -29,17 +22,22 @@ +>exports : Symbol(Container, Decl(index.js, 0, 29)) >Container : Symbol(Container, Decl(index.js, 0, 29)) --=== obj.js === --module.exports = class Obj { + === obj.js === + module.exports = class Obj { ->module.exports : Symbol(module.exports, Decl(obj.js, 0, 0)) ->module : Symbol(export=, Decl(obj.js, 0, 0)) ->exports : Symbol(export=, Decl(obj.js, 0, 0)) -->Obj : Symbol(Obj, Decl(obj.js, 0, 16)) -- -- constructor() { -- this.x = 12; ++>module.exports : Symbol(Obj, Decl(obj.js, 0, 16)) ++>module : Symbol(module.exports) ++>exports : Symbol(Obj, Decl(obj.js, 0, 16)) + >Obj : Symbol(Obj, Decl(obj.js, 0, 16)) + + constructor() { + this.x = 12; ->this.x : Symbol(Obj.x, Decl(obj.js, 1, 19)) -->this : Symbol(Obj, Decl(obj.js, 0, 16)) ++>this.x : Symbol(x, Decl(obj.js, 1, 19)) + >this : Symbol(Obj, Decl(obj.js, 0, 16)) ->x : Symbol(Obj.x, Decl(obj.js, 1, 19)) -- } --} \ No newline at end of file ++>x : Symbol(x, Decl(obj.js, 1, 19)) + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types index ce28dd2e18..5c413e4beb 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportAssignedVisibility.types @@ -2,8 +2,8 @@ === index.js === const Obj = require("./obj"); ->Obj : any ->require("./obj") : any +>Obj : typeof Obj +>require("./obj") : typeof Obj >require : any >"./obj" : "./obj" @@ -12,12 +12,12 @@ class Container { constructor() { this.usage = new Obj(); ->this.usage = new Obj() : any ->this.usage : any +>this.usage = new Obj() : Obj +>this.usage : Obj >this : this ->usage : any ->new Obj() : any ->Obj : any +>usage : Obj +>new Obj() : Obj +>Obj : typeof Obj } } @@ -28,3 +28,21 @@ module.exports = Container; >exports : typeof Container >Container : typeof Container +=== obj.js === +module.exports = class Obj { +>module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("./obj") +>module.exports : typeof import("./obj") +>module : { Obj: typeof import("./obj"); } +>exports : typeof import("./obj") +>class Obj { constructor() { this.x = 12; }} : typeof import("./obj") +>Obj : typeof import("./obj") + + constructor() { + this.x = 12; +>this.x = 12 : 12 +>this.x : number +>this : this +>x : number +>12 : 12 + } +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols index cef4a1612c..6a59046478 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols @@ -5,6 +5,7 @@ const errors = require("./errors"); >errors : Symbol(errors, Decl(index.js, 1, 5)) >require : Symbol(require) +>"./errors" : Symbol("utils/errors", Decl(errors.js, 0, 0)) module.exports = { >module.exports : Symbol(export=, Decl(index.js, 1, 35)) @@ -15,3 +16,27 @@ module.exports = { >errors : Symbol(errors, Decl(index.js, 3, 18)) }; +=== utils/errors.js === +class FancyError extends Error { +>FancyError : Symbol(FancyError, Decl(errors.js, 0, 0)) +>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) + + constructor(status) { +>status : Symbol(status, Decl(errors.js, 1, 16)) + + super(`error with status ${status}`); +>super : Symbol(ErrorConstructor, Decl(lib.es5.d.ts, --, --)) +>status : Symbol(status, Decl(errors.js, 1, 16)) + } +} + +module.exports = { +>module.exports : Symbol(export=, Decl(errors.js, 4, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(errors.js, 4, 1)) + + FancyError +>FancyError : Symbol(FancyError, Decl(errors.js, 6, 18)) + +}; + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff index 06277f7425..84b38aaf06 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.symbols.diff @@ -5,6 +5,7 @@ >errors : Symbol(errors, Decl(index.js, 1, 5)) >require : Symbol(require) ->"./errors" : Symbol(errors, Decl(errors.js, 0, 0)) ++>"./errors" : Symbol("utils/errors", Decl(errors.js, 0, 0)) module.exports = { ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) @@ -16,29 +17,16 @@ errors >errors : Symbol(errors, Decl(index.js, 3, 18)) +@@= skipped -26, +26 lines =@@ + } - }; --=== utils/errors.js === --class FancyError extends Error { -->FancyError : Symbol(FancyError, Decl(errors.js, 0, 0)) -->Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) -- -- constructor(status) { -->status : Symbol(status, Decl(errors.js, 1, 16)) -- -- super(`error with status ${status}`); -->super : Symbol(ErrorConstructor, Decl(lib.es5.d.ts, --, --)) -->status : Symbol(status, Decl(errors.js, 1, 16)) -- } --} -- --module.exports = { + module.exports = { ->module.exports : Symbol(module.exports, Decl(errors.js, 0, 0)) ->module : Symbol(module, Decl(errors.js, 4, 1)) ->exports : Symbol(module.exports, Decl(errors.js, 0, 0)) -- -- FancyError -->FancyError : Symbol(FancyError, Decl(errors.js, 6, 18)) -- --}; -- \ No newline at end of file ++>module.exports : Symbol(export=, Decl(errors.js, 4, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(errors.js, 4, 1)) + + FancyError + >FancyError : Symbol(FancyError, Decl(errors.js, 6, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types index 8419e558f6..0325a9c160 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsExportedClassAliases.types @@ -3,19 +3,47 @@ === utils/index.js === // issue arises here on compilation const errors = require("./errors"); ->errors : any ->require("./errors") : any +>errors : { FancyError: typeof FancyError; } +>require("./errors") : { FancyError: typeof FancyError; } >require : any >"./errors" : "./errors" module.exports = { ->module.exports = { errors} : { errors: any; } ->module.exports : { errors: any; } ->module : { "export=": { errors: any; }; } ->exports : { errors: any; } ->{ errors} : { errors: any; } +>module.exports = { errors} : { errors: { FancyError: typeof FancyError; }; } +>module.exports : { errors: { FancyError: typeof FancyError; }; } +>module : { "export=": { errors: { FancyError: typeof FancyError; }; }; } +>exports : { errors: { FancyError: typeof FancyError; }; } +>{ errors} : { errors: { FancyError: typeof FancyError; }; } errors ->errors : any +>errors : { FancyError: typeof FancyError; } }; +=== utils/errors.js === +class FancyError extends Error { +>FancyError : FancyError +>Error : Error + + constructor(status) { +>status : any + + super(`error with status ${status}`); +>super(`error with status ${status}`) : void +>super : ErrorConstructor +>`error with status ${status}` : string +>status : any + } +} + +module.exports = { +>module.exports = { FancyError} : { FancyError: typeof FancyError; } +>module.exports : { FancyError: typeof FancyError; } +>module : { "export=": { FancyError: typeof FancyError; }; } +>exports : { FancyError: typeof FancyError; } +>{ FancyError} : { FancyError: typeof FancyError; } + + FancyError +>FancyError : typeof FancyError + +}; + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt index 94f4922e68..b12f06b6fa 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@ -1,9 +1,15 @@ +file.js(4,11): error TS2315: Type 'Object' is not generic. +file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. +file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. +file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. file2.js(6,11): error TS2315: Type 'Object' is not generic. +file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== file2.js (3 errors) ==== +==== file2.js (4 errors) ==== const {myTypes} = require('./file.js'); /** @@ -18,6 +24,8 @@ file2.js(28,1): error TS2309: An export assignment cannot be used in a module wi }; /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ + ~~~~~~~ +!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. /** * @function testFn @@ -38,24 +46,34 @@ file2.js(28,1): error TS2309: An export assignment cannot be used in a module wi module.exports = {testFn, testFnTypes}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== file.js (0 errors) ==== +==== file.js (5 errors) ==== /** * @namespace myTypes * @global * @type {Object} + ~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. */ const myTypes = { // SOME PROPS HERE }; /** @typedef {string|RegExp|Array} myTypes.typeA */ + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. /** * @typedef myTypes.typeB + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. * @property {myTypes.typeA} prop1 - Prop 1. * @property {string} prop2 - Prop 2. */ /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + ~~~~~~~ +!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'myTypes'. exports.myTypes = myTypes; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols index e22c914a4c..3882b91669 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols @@ -4,6 +4,7 @@ const {myTypes} = require('./file.js'); >myTypes : Symbol(myTypes, Decl(file2.js, 0, 7)) >require : Symbol(require) +>'./file.js' : Symbol("file", Decl(file.js, 0, 0)) /** * @namespace testFnTypes @@ -46,3 +47,31 @@ module.exports = {testFn, testFnTypes}; >testFn : Symbol(testFn, Decl(file2.js, 27, 18)) >testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 25)) +=== file.js === +/** + * @namespace myTypes + * @global + * @type {Object} + */ +const myTypes = { +>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) + + // SOME PROPS HERE +}; + +/** @typedef {string|RegExp|Array} myTypes.typeA */ + +/** + * @typedef myTypes.typeB + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + +/** @typedef {myTypes.typeB|Function} myTypes.typeC */ + +exports.myTypes = myTypes; +>exports.myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) +>exports : Symbol("file", Decl(file.js, 0, 0)) +>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) +>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff index 1532ac94c7..a6952ae113 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols.diff @@ -1,14 +1,6 @@ --- old.jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols +++ new.jsDeclarationsImportAliasExposedWithinNamespaceCjs.symbols -@@= skipped -3, +3 lines =@@ - const {myTypes} = require('./file.js'); - >myTypes : Symbol(myTypes, Decl(file2.js, 0, 7)) - >require : Symbol(require) -->'./file.js' : Symbol("file", Decl(file.js, 0, 0)) - - /** - * @namespace testFnTypes -@@= skipped -8, +7 lines =@@ +@@= skipped -11, +11 lines =@@ * @type {Object} */ const testFnTypes = { @@ -29,31 +21,25 @@ +>exports : Symbol(export=, Decl(file2.js, 25, 1)) >testFn : Symbol(testFn, Decl(file2.js, 27, 18)) >testFnTypes : Symbol(testFnTypes, Decl(file2.js, 27, 25)) -- --=== file.js === --/** -- * @namespace myTypes -- * @global -- * @type {Object} -- */ --const myTypes = { + +@@= skipped -13, +13 lines =@@ + * @type {Object} + */ + const myTypes = { ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) -- -- // SOME PROPS HERE --}; -- --/** @typedef {string|RegExp|Array} myTypes.typeA */ -- --/** -- * @typedef myTypes.typeB -- * @property {myTypes.typeA} prop1 - Prop 1. -- * @property {string} prop2 - Prop 2. -- */ -- --/** @typedef {myTypes.typeB|Function} myTypes.typeC */ -- --exports.myTypes = myTypes; ++>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) + + // SOME PROPS HERE + }; +@@= skipped -16, +16 lines =@@ + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + + exports.myTypes = myTypes; ->exports.myTypes : Symbol(myTypes, Decl(file.js, 7, 2)) ->exports : Symbol(myTypes, Decl(file.js, 7, 2)) ->myTypes : Symbol(myTypes, Decl(file.js, 7, 2)) ->myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 50), Decl(file.js, 12, 12), Decl(file.js, 17, 38)) ++>exports.myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) ++>exports : Symbol("file", Decl(file.js, 0, 0)) ++>myTypes : Symbol(myTypes, Decl(file.js, 9, 4), Decl(file.js, 7, 2)) ++>myTypes : Symbol(myTypes, Decl(file.js, 5, 5), Decl(file.js, 9, 4), Decl(file.js, 12, 3), Decl(file.js, 17, 4)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types index c09ee82411..829b051a9f 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types @@ -3,7 +3,7 @@ === file2.js === const {myTypes} = require('./file.js'); >myTypes : any ->require('./file.js') : any +>require('./file.js') : typeof import("./file.js") >require : any >'./file.js' : "./file.js" @@ -56,3 +56,33 @@ module.exports = {testFn, testFnTypes}; >testFn : (input: testFnTypes.input) => number >testFnTypes : any +=== file.js === +/** + * @namespace myTypes + * @global + * @type {Object} + */ +const myTypes = { +>myTypes : any +>{ // SOME PROPS HERE} : {} + + // SOME PROPS HERE +}; + +/** @typedef {string|RegExp|Array} myTypes.typeA */ + +/** + * @typedef myTypes.typeB + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + +/** @typedef {myTypes.typeB|Function} myTypes.typeC */ + +exports.myTypes = myTypes; +>exports.myTypes = myTypes : any +>exports.myTypes : any +>exports : typeof import("./file") +>myTypes : any +>myTypes : any + diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols index eee4bacaf2..b353281ce8 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols @@ -3,8 +3,10 @@ === main.js === const { SomeClass, SomeClass: Another } = require('./lib'); >SomeClass : Symbol(SomeClass, Decl(main.js, 0, 7)) +>SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) >Another : Symbol(Another, Decl(main.js, 0, 18)) >require : Symbol(require) +>'./lib' : Symbol("lib", Decl(lib.js, 0, 0)) module.exports = { >module.exports : Symbol(export=, Decl(main.js, 0, 59)) @@ -17,3 +19,37 @@ module.exports = { Another >Another : Symbol(Another, Decl(main.js, 3, 14)) } +=== lib.js === +/** + * @param {string} a + */ +function bar(a) { +>bar : Symbol(bar, Decl(lib.js, 0, 0)) +>a : Symbol(a, Decl(lib.js, 3, 13)) + + return a + a; +>a : Symbol(a, Decl(lib.js, 3, 13)) +>a : Symbol(a, Decl(lib.js, 3, 13)) +} + +class SomeClass { +>SomeClass : Symbol(SomeClass, Decl(lib.js, 5, 1)) + + a() { +>a : Symbol(a, Decl(lib.js, 7, 17)) + + return 1; + } +} + +module.exports = { +>module.exports : Symbol(export=, Decl(lib.js, 11, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(lib.js, 11, 1)) + + bar, +>bar : Symbol(bar, Decl(lib.js, 13, 18)) + + SomeClass +>SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) +} diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff index 9e40ca7489..2214e6e237 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.symbols.diff @@ -1,13 +1,7 @@ --- old.jsDeclarationsReexportedCjsAlias.symbols +++ new.jsDeclarationsReexportedCjsAlias.symbols -@@= skipped -2, +2 lines =@@ - === main.js === - const { SomeClass, SomeClass: Another } = require('./lib'); - >SomeClass : Symbol(SomeClass, Decl(main.js, 0, 7)) -->SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) - >Another : Symbol(Another, Decl(main.js, 0, 18)) - >require : Symbol(require) -->'./lib' : Symbol("lib", Decl(lib.js, 0, 0)) +@@= skipped -8, +8 lines =@@ + >'./lib' : Symbol("lib", Decl(lib.js, 0, 0)) module.exports = { ->module.exports : Symbol(module.exports, Decl(main.js, 0, 0)) @@ -19,41 +13,24 @@ SomeClass, >SomeClass : Symbol(SomeClass, Decl(main.js, 2, 18)) +@@= skipped -27, +27 lines =@@ + >SomeClass : Symbol(SomeClass, Decl(lib.js, 5, 1)) - Another - >Another : Symbol(Another, Decl(main.js, 3, 14)) --} --=== lib.js === --/** -- * @param {string} a -- */ --function bar(a) { -->bar : Symbol(bar, Decl(lib.js, 0, 0)) -->a : Symbol(a, Decl(lib.js, 3, 13)) -- -- return a + a; -->a : Symbol(a, Decl(lib.js, 3, 13)) -->a : Symbol(a, Decl(lib.js, 3, 13)) --} -- --class SomeClass { -->SomeClass : Symbol(SomeClass, Decl(lib.js, 5, 1)) -- -- a() { + a() { ->a : Symbol(SomeClass.a, Decl(lib.js, 7, 17)) -- -- return 1; -- } --} -- --module.exports = { ++>a : Symbol(a, Decl(lib.js, 7, 17)) + + return 1; + } + } + + module.exports = { ->module.exports : Symbol(module.exports, Decl(lib.js, 0, 0)) ->module : Symbol(module, Decl(lib.js, 11, 1)) ->exports : Symbol(module.exports, Decl(lib.js, 0, 0)) -- -- bar, -->bar : Symbol(bar, Decl(lib.js, 13, 18)) -- -- SomeClass -->SomeClass : Symbol(SomeClass, Decl(lib.js, 14, 8)) - } \ No newline at end of file ++>module.exports : Symbol(export=, Decl(lib.js, 11, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(lib.js, 11, 1)) + + bar, + >bar : Symbol(bar, Decl(lib.js, 13, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types index 92ac5167ad..48b26294e7 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReexportedCjsAlias.types @@ -2,23 +2,61 @@ === main.js === const { SomeClass, SomeClass: Another } = require('./lib'); +>SomeClass : typeof SomeClass >SomeClass : any ->SomeClass : any ->Another : any ->require('./lib') : any +>Another : typeof SomeClass +>require('./lib') : { bar: (a: string) => string; SomeClass: typeof SomeClass; } >require : any >'./lib' : "./lib" module.exports = { ->module.exports = { SomeClass, Another} : { SomeClass: any; Another: any; } ->module.exports : { SomeClass: any; Another: any; } ->module : { "export=": { SomeClass: any; Another: any; }; } ->exports : { SomeClass: any; Another: any; } ->{ SomeClass, Another} : { SomeClass: any; Another: any; } +>module.exports = { SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } +>module.exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } +>module : { "export=": { SomeClass: typeof SomeClass; Another: typeof SomeClass; }; } +>exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } +>{ SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } SomeClass, ->SomeClass : any +>SomeClass : typeof SomeClass Another ->Another : any +>Another : typeof SomeClass +} +=== lib.js === +/** + * @param {string} a + */ +function bar(a) { +>bar : (a: string) => string +>a : string + + return a + a; +>a + a : string +>a : string +>a : string +} + +class SomeClass { +>SomeClass : SomeClass + + a() { +>a : () => number + + return 1; +>1 : 1 + } +} + +module.exports = { +>module.exports = { bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } +>module.exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } +>module : { "export=": { bar: (a: string) => string; SomeClass: typeof SomeClass; }; } +>exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } +>{ bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } + + bar, +>bar : (a: string) => string + + SomeClass +>SomeClass : typeof SomeClass } diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt new file mode 100644 index 0000000000..f263e9f33f --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt @@ -0,0 +1,46 @@ +index.js(7,19): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? +index.js(14,18): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? + + +==== test.js (0 errors) ==== + const {Render} = require("./index"); + let render = new Render(); + + render.addRectangle(); + console.log("Objects", render.objects); +==== rectangle.js (0 errors) ==== + class Rectangle { + constructor() { + console.log("I'm a rectangle!"); + } + } + + module.exports = { Rectangle }; +==== index.js (2 errors) ==== + const {Rectangle} = require('./rectangle'); + + class Render { + constructor() { + /** + * Object list + * @type {Rectangle[]} + ~~~~~~~~~ +!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? + */ + this.objects = []; + } + /** + * Adds a rectangle + * + * @returns {Rectangle} the rect + ~~~~~~~~~ +!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? + */ + addRectangle() { + const obj = new Rectangle(); + this.objects.push(obj); + return obj; + } + } + + module.exports = { Render }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols index 836aa0743d..5d93790c21 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols @@ -4,17 +4,90 @@ const {Render} = require("./index"); >Render : Symbol(Render, Decl(test.js, 0, 7)) >require : Symbol(require) +>"./index" : Symbol("index", Decl(index.js, 0, 0)) let render = new Render(); >render : Symbol(render, Decl(test.js, 1, 3)) >Render : Symbol(Render, Decl(test.js, 0, 7)) render.addRectangle(); +>render.addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) >render : Symbol(render, Decl(test.js, 1, 3)) +>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) console.log("Objects", render.objects); >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) +>render.objects : Symbol(objects, Decl(index.js, 3, 19)) >render : Symbol(render, Decl(test.js, 1, 3)) +>objects : Symbol(objects, Decl(index.js, 3, 19)) + +=== rectangle.js === +class Rectangle { +>Rectangle : Symbol(Rectangle, Decl(rectangle.js, 0, 0)) + + constructor() { + console.log("I'm a rectangle!"); +>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) + } +} + +module.exports = { Rectangle }; +>module.exports : Symbol(export=, Decl(rectangle.js, 4, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(rectangle.js, 4, 1)) +>Rectangle : Symbol(Rectangle, Decl(rectangle.js, 6, 18)) + +=== index.js === +const {Rectangle} = require('./rectangle'); +>Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) +>require : Symbol(require) +>'./rectangle' : Symbol("rectangle", Decl(rectangle.js, 0, 0)) + +class Render { +>Render : Symbol(Render, Decl(index.js, 0, 43)) + + constructor() { + /** + * Object list + * @type {Rectangle[]} + */ + this.objects = []; +>this.objects : Symbol(objects, Decl(index.js, 3, 19)) +>this : Symbol(Render, Decl(index.js, 0, 43)) +>objects : Symbol(objects, Decl(index.js, 3, 19)) + } + /** + * Adds a rectangle + * + * @returns {Rectangle} the rect + */ + addRectangle() { +>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) + + const obj = new Rectangle(); +>obj : Symbol(obj, Decl(index.js, 16, 13)) +>Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) + + this.objects.push(obj); +>this.objects.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) +>this.objects : Symbol(objects, Decl(index.js, 3, 19)) +>this : Symbol(Render, Decl(index.js, 0, 43)) +>objects : Symbol(objects, Decl(index.js, 3, 19)) +>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) +>obj : Symbol(obj, Decl(index.js, 16, 13)) + + return obj; +>obj : Symbol(obj, Decl(index.js, 16, 13)) + } +} + +module.exports = { Render }; +>module.exports : Symbol(export=, Decl(index.js, 20, 1)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(index.js, 20, 1)) +>Render : Symbol(Render, Decl(index.js, 22, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff index 530fd1602e..584479d52a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.symbols.diff @@ -1,19 +1,14 @@ --- old.jsDeclarationsReferenceToClassInstanceCrossFile.symbols +++ new.jsDeclarationsReferenceToClassInstanceCrossFile.symbols -@@= skipped -3, +3 lines =@@ - const {Render} = require("./index"); - >Render : Symbol(Render, Decl(test.js, 0, 7)) - >require : Symbol(require) -->"./index" : Symbol("index", Decl(index.js, 0, 0)) - - let render = new Render(); - >render : Symbol(render, Decl(test.js, 1, 3)) +@@= skipped -10, +10 lines =@@ >Render : Symbol(Render, Decl(test.js, 0, 7)) render.addRectangle(); ->render.addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5)) ++>render.addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) >render : Symbol(render, Decl(test.js, 1, 3)) ->addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5)) ++>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) console.log("Objects", render.objects); ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -22,73 +17,79 @@ ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) ->render.objects : Symbol(Render.objects, Decl(index.js, 3, 19)) +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) ++>render.objects : Symbol(objects, Decl(index.js, 3, 19)) >render : Symbol(render, Decl(test.js, 1, 3)) ->objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -- --=== rectangle.js === --class Rectangle { -->Rectangle : Symbol(Rectangle, Decl(rectangle.js, 0, 0)) -- -- constructor() { -- console.log("I'm a rectangle!"); ++>objects : Symbol(objects, Decl(index.js, 3, 19)) + + === rectangle.js === + class Rectangle { +@@= skipped -18, +18 lines =@@ + + constructor() { + console.log("I'm a rectangle!"); ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -->console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ++>console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) + >console : Symbol(console, Decl(lib.dom.d.ts, --, --)) ->log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) -- } --} -- --module.exports = { Rectangle }; ++>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) + } + } + + module.exports = { Rectangle }; ->module.exports : Symbol(module.exports, Decl(rectangle.js, 0, 0)) ->module : Symbol(module, Decl(rectangle.js, 4, 1)) ->exports : Symbol(module.exports, Decl(rectangle.js, 0, 0)) -->Rectangle : Symbol(Rectangle, Decl(rectangle.js, 6, 18)) -- --=== index.js === --const {Rectangle} = require('./rectangle'); -->Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) -->require : Symbol(require) -->'./rectangle' : Symbol("rectangle", Decl(rectangle.js, 0, 0)) -- --class Render { -->Render : Symbol(Render, Decl(index.js, 0, 43)) -- -- constructor() { -- /** -- * Object list -- * @type {Rectangle[]} -- */ -- this.objects = []; ++>module.exports : Symbol(export=, Decl(rectangle.js, 4, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(rectangle.js, 4, 1)) + >Rectangle : Symbol(Rectangle, Decl(rectangle.js, 6, 18)) + + === index.js === +@@= skipped -27, +27 lines =@@ + * @type {Rectangle[]} + */ + this.objects = []; ->this.objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -->this : Symbol(Render, Decl(index.js, 0, 43)) ++>this.objects : Symbol(objects, Decl(index.js, 3, 19)) + >this : Symbol(Render, Decl(index.js, 0, 43)) ->objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -- } -- /** -- * Adds a rectangle -- * -- * @returns {Rectangle} the rect -- */ -- addRectangle() { ++>objects : Symbol(objects, Decl(index.js, 3, 19)) + } + /** + * Adds a rectangle +@@= skipped -10, +10 lines =@@ + * @returns {Rectangle} the rect + */ + addRectangle() { ->addRectangle : Symbol(Render.addRectangle, Decl(index.js, 9, 5)) -- -- const obj = new Rectangle(); -->obj : Symbol(obj, Decl(index.js, 16, 13)) -->Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) -- -- this.objects.push(obj); ++>addRectangle : Symbol(addRectangle, Decl(index.js, 9, 5)) + + const obj = new Rectangle(); + >obj : Symbol(obj, Decl(index.js, 16, 13)) + >Rectangle : Symbol(Rectangle, Decl(index.js, 0, 7)) + + this.objects.push(obj); ->this.objects.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) ->this.objects : Symbol(Render.objects, Decl(index.js, 3, 19)) -->this : Symbol(Render, Decl(index.js, 0, 43)) ++>this.objects.push : Symbol(push, Decl(lib.es5.d.ts, --, --)) ++>this.objects : Symbol(objects, Decl(index.js, 3, 19)) + >this : Symbol(Render, Decl(index.js, 0, 43)) ->objects : Symbol(Render.objects, Decl(index.js, 3, 19)) ->push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --)) -->obj : Symbol(obj, Decl(index.js, 16, 13)) -- -- return obj; -->obj : Symbol(obj, Decl(index.js, 16, 13)) -- } --} -- --module.exports = { Render }; ++>objects : Symbol(objects, Decl(index.js, 3, 19)) ++>push : Symbol(push, Decl(lib.es5.d.ts, --, --)) + >obj : Symbol(obj, Decl(index.js, 16, 13)) + + return obj; +@@= skipped -20, +20 lines =@@ + } + + module.exports = { Render }; ->module.exports : Symbol(module.exports, Decl(index.js, 0, 0)) ->module : Symbol(module, Decl(index.js, 20, 1)) ->exports : Symbol(module.exports, Decl(index.js, 0, 0)) -->Render : Symbol(Render, Decl(index.js, 22, 18)) ++>module.exports : Symbol(export=, Decl(index.js, 20, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(index.js, 20, 1)) + >Render : Symbol(Render, Decl(index.js, 22, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types index 862d5664de..f80120c9be 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types @@ -2,21 +2,21 @@ === test.js === const {Render} = require("./index"); ->Render : any ->require("./index") : any +>Render : typeof Render +>require("./index") : { Render: typeof Render; } >require : any >"./index" : "./index" let render = new Render(); ->render : any ->new Render() : any ->Render : any +>render : Render +>new Render() : Render +>Render : typeof Render render.addRectangle(); ->render.addRectangle() : any ->render.addRectangle : any ->render : any ->addRectangle : any +>render.addRectangle() : Rectangle +>render.addRectangle : () => Rectangle +>render : Render +>addRectangle : () => Rectangle console.log("Objects", render.objects); >console.log("Objects", render.objects) : void @@ -24,7 +24,86 @@ console.log("Objects", render.objects); >console : Console >log : (...data: any[]) => void >"Objects" : "Objects" ->render.objects : any ->render : any ->objects : any +>render.objects : Rectangle[] +>render : Render +>objects : Rectangle[] + +=== rectangle.js === +class Rectangle { +>Rectangle : Rectangle + + constructor() { + console.log("I'm a rectangle!"); +>console.log("I'm a rectangle!") : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>"I'm a rectangle!" : "I'm a rectangle!" + } +} + +module.exports = { Rectangle }; +>module.exports = { Rectangle } : { Rectangle: typeof Rectangle; } +>module.exports : { Rectangle: typeof Rectangle; } +>module : { "export=": { Rectangle: typeof Rectangle; }; } +>exports : { Rectangle: typeof Rectangle; } +>{ Rectangle } : { Rectangle: typeof Rectangle; } +>Rectangle : typeof Rectangle + +=== index.js === +const {Rectangle} = require('./rectangle'); +>Rectangle : typeof Rectangle +>require('./rectangle') : { Rectangle: typeof Rectangle; } +>require : any +>'./rectangle' : "./rectangle" + +class Render { +>Render : Render + + constructor() { + /** + * Object list + * @type {Rectangle[]} + */ + this.objects = []; +>this.objects = [] : undefined[] +>this.objects : Rectangle[] +>this : this +>objects : Rectangle[] +>[] : undefined[] + } + /** + * Adds a rectangle + * + * @returns {Rectangle} the rect + */ + addRectangle() { +>addRectangle : () => Rectangle + + const obj = new Rectangle(); +>obj : Rectangle +>new Rectangle() : Rectangle +>Rectangle : typeof Rectangle + + this.objects.push(obj); +>this.objects.push(obj) : number +>this.objects.push : (...items: Rectangle[]) => number +>this.objects : Rectangle[] +>this : this +>objects : Rectangle[] +>push : (...items: Rectangle[]) => number +>obj : Rectangle + + return obj; +>obj : Rectangle + } +} + +module.exports = { Render }; +>module.exports = { Render } : { Render: typeof Render; } +>module.exports : { Render: typeof Render; } +>module : { "export=": { Render: typeof Render; }; } +>exports : { Render: typeof Render; } +>{ Render } : { Render: typeof Render; } +>Render : typeof Render diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt index 07fcf76b77..0bb4eb949a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@ -1,10 +1,15 @@ +index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +module.js(24,12): error TS2315: Type 'Object' is not generic. +module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== const {taskGroups, taskNameToGroup} = require('./module.js'); /** @typedef {import('./module.js').TaskGroup} TaskGroup */ + ~~~~~~~~~ +!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. /** * @typedef TaskNode @@ -25,7 +30,7 @@ index.js(21,1): error TS2309: An export assignment cannot be used in a module wi module.exports = MainThreadTasks; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== module.js (0 errors) ==== +==== module.js (2 errors) ==== /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ /** @@ -50,9 +55,16 @@ index.js(21,1): error TS2309: An export assignment cannot be used in a module wi } /** @type {Object} */ + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2315: Type 'Object' is not generic. const taskNameToGroup = {}; module.exports = { + ~~~~~~~~~~~~~~~~~~ taskGroups, + ~~~~~~~~~~~~~~~ taskNameToGroup, - }; \ No newline at end of file + ~~~~~~~~~~~~~~~~~~~~ + }; + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols index 270ee2b76d..383deeead4 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols @@ -5,6 +5,7 @@ const {taskGroups, taskNameToGroup} = require('./module.js'); >taskGroups : Symbol(taskGroups, Decl(index.js, 0, 7)) >taskNameToGroup : Symbol(taskNameToGroup, Decl(index.js, 0, 18)) >require : Symbol(require) +>'./module.js' : Symbol("module", Decl(module.js, 0, 0)) /** @typedef {import('./module.js').TaskGroup} TaskGroup */ @@ -34,3 +35,57 @@ module.exports = MainThreadTasks; >exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) +=== module.js === +/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + +/** + * @typedef TaskGroup + * @property {TaskGroupIds} id + * @property {string} label + * @property {string[]} traceEventNames + */ + +/** + * @type {{[P in TaskGroupIds]: {id: P, label: string}}} + */ +const taskGroups = { +>taskGroups : Symbol(taskGroups, Decl(module.js, 12, 5)) + + parseHTML: { +>parseHTML : Symbol(parseHTML, Decl(module.js, 12, 20)) + + id: 'parseHTML', +>id : Symbol(id, Decl(module.js, 13, 16)) + + label: 'Parse HTML & CSS' +>label : Symbol(label, Decl(module.js, 14, 24)) + + }, + styleLayout: { +>styleLayout : Symbol(styleLayout, Decl(module.js, 16, 6)) + + id: 'styleLayout', +>id : Symbol(id, Decl(module.js, 17, 18)) + + label: 'Style & Layout' +>label : Symbol(label, Decl(module.js, 18, 26)) + + }, +} + +/** @type {Object} */ +const taskNameToGroup = {}; +>taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 24, 5)) + +module.exports = { +>module.exports : Symbol(export=, Decl(module.js, 24, 27)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(module.js, 24, 27)) + + taskGroups, +>taskGroups : Symbol(taskGroups, Decl(module.js, 26, 18)) + + taskNameToGroup, +>taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 27, 15)) + +}; diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff index 38f767f395..ec22f5af98 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.symbols.diff @@ -1,14 +1,6 @@ --- old.jsDeclarationsTypedefPropertyAndExportAssignment.symbols +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.symbols -@@= skipped -4, +4 lines =@@ - >taskGroups : Symbol(taskGroups, Decl(index.js, 0, 7)) - >taskNameToGroup : Symbol(taskNameToGroup, Decl(index.js, 0, 18)) - >require : Symbol(require) -->'./module.js' : Symbol("module", Decl(module.js, 0, 0)) - - /** @typedef {import('./module.js').TaskGroup} TaskGroup */ - -@@= skipped -25, +24 lines =@@ +@@= skipped -29, +29 lines =@@ } module.exports = MainThreadTasks; @@ -20,57 +12,17 @@ +>exports : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) >MainThreadTasks : Symbol(MainThreadTasks, Decl(index.js, 0, 61)) --=== module.js === --/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ -- --/** -- * @typedef TaskGroup -- * @property {TaskGroupIds} id -- * @property {string} label -- * @property {string[]} traceEventNames -- */ -- --/** -- * @type {{[P in TaskGroupIds]: {id: P, label: string}}} -- */ --const taskGroups = { -->taskGroups : Symbol(taskGroups, Decl(module.js, 12, 5)) -- -- parseHTML: { -->parseHTML : Symbol(parseHTML, Decl(module.js, 12, 20)) -- -- id: 'parseHTML', -->id : Symbol(id, Decl(module.js, 13, 16)) -- -- label: 'Parse HTML & CSS' -->label : Symbol(label, Decl(module.js, 14, 24)) -- -- }, -- styleLayout: { -->styleLayout : Symbol(styleLayout, Decl(module.js, 16, 6)) -- -- id: 'styleLayout', -->id : Symbol(id, Decl(module.js, 17, 18)) -- -- label: 'Style & Layout' -->label : Symbol(label, Decl(module.js, 18, 26)) -- -- }, --} -- --/** @type {Object} */ --const taskNameToGroup = {}; -->taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 24, 5)) -- --module.exports = { + === module.js === +@@= skipped -48, +48 lines =@@ + >taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 24, 5)) + + module.exports = { ->module.exports : Symbol(module.exports, Decl(module.js, 0, 0)) ->module : Symbol(module, Decl(module.js, 24, 27)) ->exports : Symbol(module.exports, Decl(module.js, 0, 0)) -- -- taskGroups, -->taskGroups : Symbol(taskGroups, Decl(module.js, 26, 18)) -- -- taskNameToGroup, -->taskNameToGroup : Symbol(taskNameToGroup, Decl(module.js, 27, 15)) -- --}; \ No newline at end of file ++>module.exports : Symbol(export=, Decl(module.js, 24, 27)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(module.js, 24, 27)) + + taskGroups, + >taskGroups : Symbol(taskGroups, Decl(module.js, 26, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types index d682b59ca7..02e415dd5a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types @@ -2,9 +2,9 @@ === index.js === const {taskGroups, taskNameToGroup} = require('./module.js'); ->taskGroups : any +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } >taskNameToGroup : any ->require('./module.js') : any +>require('./module.js') : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } >require : any >'./module.js' : "./module.js" @@ -37,3 +37,67 @@ module.exports = MainThreadTasks; >exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks +=== module.js === +/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + +/** + * @typedef TaskGroup + * @property {TaskGroupIds} id + * @property {string} label + * @property {string[]} traceEventNames + */ + +/** + * @type {{[P in TaskGroupIds]: {id: P, label: string}}} + */ +const taskGroups = { +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } +>{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + + parseHTML: { +>parseHTML : { id: "parseHTML"; label: string; } +>{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: "parseHTML"; label: string; } + + id: 'parseHTML', +>id : "parseHTML" +>'parseHTML' : "parseHTML" + + label: 'Parse HTML & CSS' +>label : string +>'Parse HTML & CSS' : "Parse HTML & CSS" + + }, + styleLayout: { +>styleLayout : { id: "styleLayout"; label: string; } +>{ id: 'styleLayout', label: 'Style & Layout' } : { id: "styleLayout"; label: string; } + + id: 'styleLayout', +>id : "styleLayout" +>'styleLayout' : "styleLayout" + + label: 'Style & Layout' +>label : string +>'Style & Layout' : "Style & Layout" + + }, +} + +/** @type {Object} */ +const taskNameToGroup = {}; +>taskNameToGroup : any +>{} : {} + +module.exports = { +>module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>module.exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>module : { "export=": { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; }; } +>exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } +>{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } + + taskGroups, +>taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + + taskNameToGroup, +>taskNameToGroup : any + +}; diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols index f4fbe092fa..0b2cf45d42 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols @@ -8,18 +8,23 @@ var c; >c : Symbol(c, Decl(use.js, 3, 3)) c.chunk; +>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) +>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) /** @type {D} */ var d; >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; +>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; @@ -33,3 +38,21 @@ declare var module: { exports: any }; >module : Symbol(module, Decl(types.d.ts, 2, 11)) >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) +=== mod1.js === +/// +class Chunk { +>Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) + + constructor() { + this.chunk = 1; +>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) +>this : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } +} +module.exports = Chunk; +>module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) +>Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff index ebcf1cf979..3fce0e069e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.symbols.diff @@ -5,44 +5,41 @@ c.chunk; ->c.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) - >require : Symbol(require, Decl(types.d.ts, 0, 0)) -->"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) - - /** @type {D} */ - var d; +@@= skipped -14, +14 lines =@@ >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; ->d.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; -@@= skipped -29, +24 lines =@@ - declare var module: { exports: any }; - >module : Symbol(module, Decl(types.d.ts, 2, 11)) - >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) -- --=== mod1.js === --/// --class Chunk { -->Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) -- -- constructor() { -- this.chunk = 1; +@@= skipped -23, +23 lines =@@ + + constructor() { + this.chunk = 1; ->this.chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -->this : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + >this : Symbol(Chunk, Decl(mod1.js, 0, 0)) ->chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -- } --} --module.exports = Chunk; ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } + } + module.exports = Chunk; ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 5, 1)) ->exports : Symbol(export=, Decl(mod1.js, 5, 1)) -->Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>module.exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(Chunk, Decl(mod1.js, 0, 0)) + >Chunk : Symbol(Chunk, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types index 0e082a75f6..c028a0875a 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType.types @@ -5,27 +5,27 @@ /** @typedef {import("./mod1")} C * @type {C} */ var c; ->c : any +>c : D c.chunk; ->c.chunk : any ->c : any ->chunk : any +>c.chunk : number +>c : D +>chunk : number const D = require("./mod1"); ->D : any ->require("./mod1") : any +>D : typeof D +>require("./mod1") : typeof D >require : (name: string) => any >"./mod1" : "./mod1" /** @type {D} */ var d; ->d : error +>d : D d.chunk; ->d.chunk : any +>d.chunk : number >d : D ->chunk : any +>chunk : number === types.d.ts === declare function require(name: string): any; @@ -39,3 +39,24 @@ declare var module: { exports: any }; >module : { exports: any; } >exports : any +=== mod1.js === +/// +class Chunk { +>Chunk : Chunk + + constructor() { + this.chunk = 1; +>this.chunk = 1 : 1 +>this.chunk : number +>this : this +>chunk : number +>1 : 1 + } +} +module.exports = Chunk; +>module.exports = Chunk : typeof Chunk +>module.exports : typeof Chunk +>module : { Chunk: typeof Chunk; } +>exports : typeof Chunk +>Chunk : typeof Chunk + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols index 2a73980c73..3b00ab377e 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols @@ -8,18 +8,23 @@ var c; >c : Symbol(c, Decl(use.js, 3, 3)) c.chunk; +>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) >require : Symbol(require, Decl(types.d.ts, 0, 0)) +>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) /** @type {D} */ var d; >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; +>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; @@ -33,3 +38,19 @@ declare var module: { exports: any }; >module : Symbol(module, Decl(types.d.ts, 2, 11)) >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) +=== mod1.js === +/// +module.exports = class Chunk { +>module.exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) +>module : Symbol(module.exports) +>exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) +>Chunk : Symbol(Chunk, Decl(mod1.js, 1, 16)) + + constructor() { + this.chunk = 1; +>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) +>this : Symbol(Chunk, Decl(mod1.js, 1, 16)) +>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff index dc3a932a6c..c58d685f92 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.symbols.diff @@ -5,42 +5,43 @@ c.chunk; ->c.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>c.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >c : Symbol(c, Decl(use.js, 3, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) const D = require("./mod1"); >D : Symbol(D, Decl(use.js, 6, 5)) - >require : Symbol(require, Decl(types.d.ts, 0, 0)) -->"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) - - /** @type {D} */ - var d; +@@= skipped -14, +14 lines =@@ >d : Symbol(d, Decl(use.js, 8, 3)) d.chunk; ->d.chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>d.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) >d : Symbol(d, Decl(use.js, 8, 3)) ->chunk : Symbol(D.chunk, Decl(mod1.js, 2, 19)) ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) === types.d.ts === declare function require(name: string): any; -@@= skipped -29, +24 lines =@@ - declare var module: { exports: any }; - >module : Symbol(module, Decl(types.d.ts, 2, 11)) - >exports : Symbol(exports, Decl(types.d.ts, 2, 21)) -- --=== mod1.js === --/// --module.exports = class Chunk { +@@= skipped -19, +19 lines =@@ + === mod1.js === + /// + module.exports = class Chunk { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) ->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -->Chunk : Symbol(Chunk, Decl(mod1.js, 1, 16)) -- -- constructor() { -- this.chunk = 1; ++>module.exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) ++>module : Symbol(module.exports) ++>exports : Symbol(Chunk, Decl(mod1.js, 1, 16)) + >Chunk : Symbol(Chunk, Decl(mod1.js, 1, 16)) + + constructor() { + this.chunk = 1; ->this.chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -->this : Symbol(Chunk, Decl(mod1.js, 1, 16)) ++>this.chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + >this : Symbol(Chunk, Decl(mod1.js, 1, 16)) ->chunk : Symbol(Chunk.chunk, Decl(mod1.js, 2, 19)) -- } --} ++>chunk : Symbol(chunk, Decl(mod1.js, 2, 19)) + } + } diff --git a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types index fe33c1d437..3b14ed6cdc 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocImportType2.types @@ -5,27 +5,27 @@ /** @typedef {import("./mod1")} C * @type {C} */ var c; ->c : any +>c : D c.chunk; ->c.chunk : any ->c : any ->chunk : any +>c.chunk : number +>c : D +>chunk : number const D = require("./mod1"); ->D : any ->require("./mod1") : any +>D : typeof D +>require("./mod1") : typeof D >require : (name: string) => any >"./mod1" : "./mod1" /** @type {D} */ var d; ->d : error +>d : D d.chunk; ->d.chunk : any +>d.chunk : number >d : D ->chunk : any +>chunk : number === types.d.ts === declare function require(name: string): any; @@ -39,3 +39,23 @@ declare var module: { exports: any }; >module : { exports: any; } >exports : any +=== mod1.js === +/// +module.exports = class Chunk { +>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") +>module.exports : typeof import("./mod1") +>module : { Chunk: typeof import("./mod1"); } +>exports : typeof import("./mod1") +>class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") +>Chunk : typeof import("./mod1") + + constructor() { + this.chunk = 1; +>this.chunk = 1 : 1 +>this.chunk : number +>this : this +>chunk : number +>1 : 1 + } +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt index dc40da3a99..7763b5edfe 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.errors.txt @@ -1,22 +1,37 @@ -use.js(1,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. +mod.js(2,21): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. +mod.js(2,37): error TS7006: Parameter 'n' implicitly has an 'any' type. +mod.js(6,35): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. +mod.js(6,51): error TS7006: Parameter 'mom' implicitly has an 'any' type. +use.js(3,5): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. +use.js(5,5): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. -==== use.js (1 errors) ==== +==== use.js (2 errors) ==== var mod = require('./mod'); - ~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. mod.f('no') mod.g('also no') + ~ +!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. mod.h(0) mod.i(1) + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. -==== mod.js (0 errors) ==== +==== mod.js (4 errors) ==== /** @param {number} n */ exports.f = exports.g = function fg(n) { + ~ +!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. + ~ +!!! error TS7006: Parameter 'n' implicitly has an 'any' type. return n + 1 } /** @param {string} mom */ module.exports.h = module.exports.i = function hi(mom) { + ~ +!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. + ~~~ +!!! error TS7006: Parameter 'mom' implicitly has an 'any' type. return `hi, ${mom}!`; } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols index 6453d6ee4a..dfaa882c92 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols @@ -4,16 +4,51 @@ var mod = require('./mod'); >mod : Symbol(mod, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) mod.f('no') +>mod.f : Symbol(f, Decl(mod.js, 0, 0)) >mod : Symbol(mod, Decl(use.js, 0, 3)) +>f : Symbol(f, Decl(mod.js, 0, 0)) mod.g('also no') >mod : Symbol(mod, Decl(use.js, 0, 3)) mod.h(0) +>mod.h : Symbol(h, Decl(mod.js, 3, 1)) >mod : Symbol(mod, Decl(use.js, 0, 3)) +>h : Symbol(h, Decl(mod.js, 3, 1)) mod.i(1) >mod : Symbol(mod, Decl(use.js, 0, 3)) +=== mod.js === +/** @param {number} n */ +exports.f = exports.g = function fg(n) { +>exports.f : Symbol(f, Decl(mod.js, 0, 0)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>f : Symbol(f, Decl(mod.js, 0, 0)) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>fg : Symbol(fg, Decl(mod.js, 1, 23)) +>n : Symbol(n, Decl(mod.js, 1, 36)) + + return n + 1 +>n : Symbol(n, Decl(mod.js, 1, 36)) +} +/** @param {string} mom */ +module.exports.h = module.exports.i = function hi(mom) { +>module.exports.h : Symbol(h, Decl(mod.js, 3, 1)) +>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>h : Symbol(h, Decl(mod.js, 3, 1)) +>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod", Decl(mod.js, 0, 0)) +>hi : Symbol(hi, Decl(mod.js, 5, 37)) +>mom : Symbol(mom, Decl(mod.js, 5, 50)) + + return `hi, ${mom}!`; +>mom : Symbol(mom, Decl(mod.js, 5, 50)) +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff index a7faa4ca60..11a82589da 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.symbols.diff @@ -5,11 +5,14 @@ >mod : Symbol(mod, Decl(use.js, 0, 3)) >require : Symbol(require) ->'./mod' : Symbol(mod, Decl(mod.js, 0, 0)) ++>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) mod.f('no') ->mod.f : Symbol(mod.f, Decl(mod.js, 0, 0)) ++>mod.f : Symbol(f, Decl(mod.js, 0, 0)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->f : Symbol(mod.f, Decl(mod.js, 0, 0)) ++>f : Symbol(f, Decl(mod.js, 0, 0)) mod.g('also no') ->mod.g : Symbol(mod.g, Decl(mod.js, 1, 11)) @@ -18,44 +21,48 @@ mod.h(0) ->mod.h : Symbol(mod.h, Decl(mod.js, 3, 1)) ++>mod.h : Symbol(h, Decl(mod.js, 3, 1)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->h : Symbol(mod.h, Decl(mod.js, 3, 1)) ++>h : Symbol(h, Decl(mod.js, 3, 1)) mod.i(1) ->mod.i : Symbol(mod.i, Decl(mod.js, 5, 18)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->i : Symbol(mod.i, Decl(mod.js, 5, 18)) -- --=== mod.js === --/** @param {number} n */ --exports.f = exports.g = function fg(n) { -->exports.f : Symbol(f, Decl(mod.js, 0, 0)) + + === mod.js === + /** @param {number} n */ + exports.f = exports.g = function fg(n) { + >exports.f : Symbol(f, Decl(mod.js, 0, 0)) ->exports : Symbol(f, Decl(mod.js, 0, 0)) -->f : Symbol(f, Decl(mod.js, 0, 0)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >f : Symbol(f, Decl(mod.js, 0, 0)) ->exports.g : Symbol(g, Decl(mod.js, 1, 11)) ->exports : Symbol(g, Decl(mod.js, 1, 11)) ->g : Symbol(g, Decl(mod.js, 1, 11)) -->fg : Symbol(fg, Decl(mod.js, 1, 23)) -->n : Symbol(n, Decl(mod.js, 1, 36)) -- -- return n + 1 -->n : Symbol(n, Decl(mod.js, 1, 36)) --} --/** @param {string} mom */ --module.exports.h = module.exports.i = function hi(mom) { -->module.exports.h : Symbol(h, Decl(mod.js, 3, 1)) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >fg : Symbol(fg, Decl(mod.js, 1, 23)) + >n : Symbol(n, Decl(mod.js, 1, 36)) + +@@= skipped -40, +34 lines =@@ + /** @param {string} mom */ + module.exports.h = module.exports.i = function hi(mom) { + >module.exports.h : Symbol(h, Decl(mod.js, 3, 1)) ->module.exports : Symbol(h, Decl(mod.js, 3, 1)) ->module : Symbol(module, Decl(mod.js, 3, 1)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) -->h : Symbol(h, Decl(mod.js, 3, 1)) ++>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >h : Symbol(h, Decl(mod.js, 3, 1)) ->module.exports.i : Symbol(i, Decl(mod.js, 5, 18)) ->module.exports : Symbol(i, Decl(mod.js, 5, 18)) ->module : Symbol(module, Decl(mod.js, 3, 1)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->i : Symbol(i, Decl(mod.js, 5, 18)) -->hi : Symbol(hi, Decl(mod.js, 5, 37)) -->mom : Symbol(mom, Decl(mod.js, 5, 50)) -- -- return `hi, ${mom}!`; -->mom : Symbol(mom, Decl(mod.js, 5, 50)) --} ++>module.exports : Symbol("mod", Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod", Decl(mod.js, 0, 0)) + >hi : Symbol(hi, Decl(mod.js, 5, 37)) + >mom : Symbol(mom, Decl(mod.js, 5, 50)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types index 1043bd0ba7..59e1fe3f85 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeFromChainedAssignment2.types @@ -2,36 +2,79 @@ === use.js === var mod = require('./mod'); ->mod : any ->require('./mod') : any +>mod : typeof mod +>require('./mod') : typeof mod >require : any >'./mod' : "./mod" mod.f('no') >mod.f('no') : any ->mod.f : any ->mod : any ->f : any +>mod.f : (n: any) => any +>mod : typeof mod +>f : (n: any) => any >'no' : "no" mod.g('also no') >mod.g('also no') : any >mod.g : any ->mod : any +>mod : typeof mod >g : any >'also no' : "also no" mod.h(0) ->mod.h(0) : any ->mod.h : any ->mod : any ->h : any +>mod.h(0) : string +>mod.h : (mom: any) => string +>mod : typeof mod +>h : (mom: any) => string >0 : 0 mod.i(1) >mod.i(1) : any >mod.i : any ->mod : any +>mod : typeof mod >i : any >1 : 1 +=== mod.js === +/** @param {number} n */ +exports.f = exports.g = function fg(n) { +>exports.f = exports.g = function fg(n) { return n + 1} : (n: any) => any +>exports.f : (n: any) => any +>exports : typeof import("./mod") +>f : (n: any) => any +>exports.g = function fg(n) { return n + 1} : (n: any) => any +>exports.g : any +>exports : typeof import("./mod") +>g : any +>function fg(n) { return n + 1} : (n: any) => any +>fg : (n: any) => any +>n : any + + return n + 1 +>n + 1 : any +>n : any +>1 : 1 +} +/** @param {string} mom */ +module.exports.h = module.exports.i = function hi(mom) { +>module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string +>module.exports.h : (mom: any) => string +>module.exports : typeof import("./mod") +>module : { "\"mod\"": typeof import("./mod"); } +>exports : typeof import("./mod") +>h : (mom: any) => string +>module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string +>module.exports.i : any +>module.exports : typeof import("./mod") +>module : { "\"mod\"": typeof import("./mod"); } +>exports : typeof import("./mod") +>i : any +>function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string +>hi : (mom: any) => string +>mom : any + + return `hi, ${mom}!`; +>`hi, ${mom}!` : string +>mom : any +} + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt index 7b6777e042..d5614f6c67 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt @@ -1,4 +1,5 @@ MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ==== MC.js (1 errors) ==== @@ -18,7 +19,7 @@ MC.js(5,1): error TS2309: An export assignment cannot be used in a module with o ~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MW.js (0 errors) ==== +==== MW.js (1 errors) ==== /** @typedef {import("./MC")} MC */ class MW { @@ -31,4 +32,6 @@ MC.js(5,1): error TS2309: An export assignment cannot be used in a module with o } module.exports = MW; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols index 22778ecead..812b695c5b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols @@ -4,6 +4,7 @@ const MW = require("./MW"); >MW : Symbol(MW, Decl(MC.js, 0, 5)) >require : Symbol(require) +>"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) /** @typedef {number} Cictema */ @@ -22,3 +23,29 @@ module.exports = class MC { } }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + + this.compiler = compiler; +>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>this : Symbol(MW, Decl(MW.js, 0, 0)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } +} + +module.exports = MW; +>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(MW, Decl(MW.js, 0, 0)) +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff index c984afa8e1..3ff921e892 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.symbols.diff @@ -1,11 +1,6 @@ --- old.jsdocTypeReferenceToImportOfClassExpression.symbols +++ new.jsdocTypeReferenceToImportOfClassExpression.symbols -@@= skipped -3, +3 lines =@@ - const MW = require("./MW"); - >MW : Symbol(MW, Decl(MC.js, 0, 5)) - >require : Symbol(require) -->"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) - +@@= skipped -8, +8 lines =@@ /** @typedef {number} Cictema */ module.exports = class MC { @@ -23,32 +18,24 @@ return new MW(this); >MW : Symbol(MW, Decl(MC.js, 0, 5)) - >this : Symbol(MC, Decl(MC.js, 4, 16)) - } - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : Symbol(MW, Decl(MW.js, 0, 0)) -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- -- this.compiler = compiler; +@@= skipped -27, +27 lines =@@ + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + + this.compiler = compiler; ->this.compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->this : Symbol(MW, Decl(MW.js, 0, 0)) ++>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >this : Symbol(MW, Decl(MW.js, 0, 0)) ->compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- } --} -- --module.exports = MW; ++>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } + } + + module.exports = MW; ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -->MW : Symbol(MW, Decl(MW.js, 0, 0)) ++>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(MW, Decl(MW.js, 0, 0)) + >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types index e022bd666d..d1d05b562b 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfClassExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : any ->require("./MW") : any +>MW : typeof MW +>require("./MW") : typeof MW >require : any >"./MW" : "./MW" @@ -18,12 +18,40 @@ module.exports = class MC { >MC : typeof import("./MC") watch() { ->watch : () => any +>watch : () => MW return new MW(this); ->new MW(this) : any ->MW : any +>new MW(this) : MW +>MW : typeof MW >this : this } }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : MW + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : import("./MC") + + this.compiler = compiler; +>this.compiler = compiler : import("./MC") +>this.compiler : import("./MC") +>this : this +>compiler : import("./MC") +>compiler : import("./MC") + } +} + +module.exports = MW; +>module.exports = MW : typeof MW +>module.exports : typeof MW +>module : { MW: typeof MW; } +>exports : typeof MW +>MW : typeof MW + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt index 1e0c9ba519..38ff7cb972 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt @@ -1,4 +1,6 @@ MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? +MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ==== MC.js (1 errors) ==== @@ -19,8 +21,10 @@ MC.js(6,1): error TS2309: An export assignment cannot be used in a module with o ~ !!! error TS2309: An export assignment cannot be used in a module with other exported elements. -==== MW.js (0 errors) ==== +==== MW.js (2 errors) ==== /** @typedef {import("./MC")} MC */ + ~~~~~~~~~~~~~~ +!!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? class MW { /** @@ -32,4 +36,6 @@ MC.js(6,1): error TS2309: An export assignment cannot be used in a module with o } module.exports = MW; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols index 1c9cadddd7..39ab556833 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols @@ -4,6 +4,7 @@ const MW = require("./MW"); >MW : Symbol(MW, Decl(MC.js, 0, 5)) >require : Symbol(require) +>"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) /** @typedef {number} Meyerhauser */ @@ -24,3 +25,29 @@ module.exports = function MC() { }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + + this.compiler = compiler; +>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>this : Symbol(MW, Decl(MW.js, 0, 0)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) +>compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } +} + +module.exports = MW; +>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(MW, Decl(MW.js, 0, 0)) +>MW : Symbol(MW, Decl(MW.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff index 01d931837b..7d4a079c8c 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.symbols.diff @@ -1,12 +1,6 @@ --- old.jsdocTypeReferenceToImportOfFunctionExpression.symbols +++ new.jsdocTypeReferenceToImportOfFunctionExpression.symbols -@@= skipped -3, +3 lines =@@ - const MW = require("./MW"); - >MW : Symbol(MW, Decl(MC.js, 0, 5)) - >require : Symbol(require) -->"./MW" : Symbol("MW", Decl(MW.js, 0, 0)) - - /** @typedef {number} Meyerhauser */ +@@= skipped -9, +9 lines =@@ /** @class */ module.exports = function MC() { @@ -17,33 +11,24 @@ >exports : Symbol(export=, Decl(MC.js, 0, 27)) >MC : Symbol(MC, Decl(MC.js, 5, 16)) -@@= skipped -20, +19 lines =@@ - >x : Symbol(x, Decl(MC.js, 7, 7)) +@@= skipped -28, +28 lines =@@ + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : Symbol(MW, Decl(MW.js, 0, 0)) -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- -- this.compiler = compiler; + this.compiler = compiler; ->this.compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->this : Symbol(MW, Decl(MW.js, 0, 0)) ++>this.compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >this : Symbol(MW, Decl(MW.js, 0, 0)) ->compiler : Symbol(MW.compiler, Decl(MW.js, 6, 25)) -->compiler : Symbol(compiler, Decl(MW.js, 6, 14)) -- } --} -- --module.exports = MW; ++>compiler : Symbol(compiler, Decl(MW.js, 6, 25)) + >compiler : Symbol(compiler, Decl(MW.js, 6, 14)) + } + } + + module.exports = MW; ->module.exports : Symbol(module.exports, Decl(MW.js, 0, 0)) ->module : Symbol(export=, Decl(MW.js, 9, 1)) ->exports : Symbol(export=, Decl(MW.js, 9, 1)) -->MW : Symbol(MW, Decl(MW.js, 0, 0)) ++>module.exports : Symbol(MW, Decl(MW.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(MW, Decl(MW.js, 0, 0)) + >MW : Symbol(MW, Decl(MW.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types index 5c7ef0e913..760a183f55 100644 --- a/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types +++ b/testdata/baselines/reference/submodule/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types @@ -2,8 +2,8 @@ === MC.js === const MW = require("./MW"); ->MW : any ->require("./MW") : any +>MW : typeof MW +>require("./MW") : typeof MW >require : any >"./MW" : "./MW" @@ -11,12 +11,12 @@ const MW = require("./MW"); /** @class */ module.exports = function MC() { ->module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any ->module.exports : () => any ->module : { "export=": () => any; } ->exports : () => any ->function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any ->MC : () => any +>module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW +>module.exports : () => MW +>module : { "export=": () => MW; } +>exports : () => MW +>function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW +>MC : () => MW /** @type {any} */ var x = {} @@ -24,9 +24,37 @@ module.exports = function MC() { >{} : {} return new MW(x); ->new MW(x) : any ->MW : any +>new MW(x) : MW +>MW : typeof MW >x : any }; +=== MW.js === +/** @typedef {import("./MC")} MC */ + +class MW { +>MW : MW + + /** + * @param {MC} compiler the compiler + */ + constructor(compiler) { +>compiler : any + + this.compiler = compiler; +>this.compiler = compiler : any +>this.compiler : any +>this : this +>compiler : any +>compiler : any + } +} + +module.exports = MW; +>module.exports = MW : typeof MW +>module.exports : typeof MW +>module : { MW: typeof MW; } +>exports : typeof MW +>MW : typeof MW + diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt index 2386146085..a63a73e1e2 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt @@ -1,18 +1,35 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport1.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +lateBoundAssignmentDeclarationSupport1.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -==== usage.js (1 errors) ==== +==== usage.js (2 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport1.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. const y = x["my-fake-sym"]; + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. const z = x[x.S]; + ~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -==== lateBoundAssignmentDeclarationSupport1.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport1.js (2 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; exports[_sym] = "ok"; + ~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. exports[_str] = "ok"; + ~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols index 62f962f254..b663516983 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols @@ -4,6 +4,7 @@ const x = require("./lateBoundAssignmentDeclarationSupport1.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport1.js" : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) @@ -12,5 +13,30 @@ const y = x["my-fake-sym"]; const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) + +=== lateBoundAssignmentDeclarationSupport1.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) + +exports[_sym] = "ok"; +>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) + +exports[_str] = "ok"; +>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) + +exports.S = _sym; +>exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) +>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff index b71f2864f0..cabb14b7db 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.symbols.diff @@ -5,36 +5,27 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport1.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport1.js" : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -9, +9 lines =@@ const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) -- --=== lateBoundAssignmentDeclarationSupport1.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) -- --exports[_sym] = "ok"; -->exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) -- --exports[_str] = "ok"; -->exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport1.js, 2, 5)) -- --exports.S = _sym; -->exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) + + === lateBoundAssignmentDeclarationSupport1.js === + // currently unsupported +@@= skipped -23, +23 lines =@@ + + exports.S = _sym; + >exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) ->exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport1", Decl(lateBoundAssignmentDeclarationSupport1.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport1.js, 5, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport1.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types index dccd599da6..485d488783 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport1.types @@ -2,22 +2,54 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport1.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport1.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport1.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport1.js" : "./lateBoundAssignmentDeclarationSupport1.js" const y = x["my-fake-sym"]; >y : any >x["my-fake-sym"] : any ->x : any +>x : typeof x >"my-fake-sym" : "my-fake-sym" const z = x[x.S]; >z : any >x[x.S] : any ->x : any ->x.S : any ->x : any ->S : any +>x : typeof x +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport1.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +exports[_sym] = "ok"; +>exports[_sym] = "ok" : "ok" +>exports[_sym] : any +>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") +>_sym : unique symbol +>"ok" : "ok" + +exports[_str] = "ok"; +>exports[_str] = "ok" : "ok" +>exports[_str] : any +>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") +>_str : "my-fake-sym" +>"ok" : "ok" + +exports.S = _sym; +>exports.S = _sym : unique symbol +>exports.S : unique symbol +>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt index 098bb6132d..8533aa1d2e 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt @@ -1,18 +1,35 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport2.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -==== usage.js (1 errors) ==== +==== usage.js (2 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport2.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. const y = x["my-fake-sym"]; + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. const z = x[x.S]; + ~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -==== lateBoundAssignmentDeclarationSupport2.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport2.js (2 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; module.exports[_sym] = "ok"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports[_str] = "ok"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols index 3b5126d2b3..c9654d78f5 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols @@ -4,6 +4,7 @@ const x = require("./lateBoundAssignmentDeclarationSupport2.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport2.js" : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) @@ -12,5 +13,36 @@ const y = x["my-fake-sym"]; const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) + +=== lateBoundAssignmentDeclarationSupport2.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + +module.exports[_sym] = "ok"; +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) + +module.exports[_str] = "ok"; +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff index d3a722c5dd..b2436e84ab 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.symbols.diff @@ -5,42 +5,50 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport2.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport2.js" : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -9, +9 lines =@@ const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) -- --=== lateBoundAssignmentDeclarationSupport2.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) -- --module.exports[_sym] = "ok"; ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) + + === lateBoundAssignmentDeclarationSupport2.js === + // currently unsupported +@@= skipped -14, +14 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + + module.exports[_sym] = "ok"; ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) -- --module.exports[_str] = "ok"; ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) + + module.exports[_str] = "ok"; ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport2.js, 2, 5)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport2", Decl(lateBoundAssignmentDeclarationSupport2.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport2.js, 5, 28)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport2.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types index b3614e356b..82e108b006 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport2.types @@ -2,22 +2,60 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport2.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport2.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport2.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport2.js" : "./lateBoundAssignmentDeclarationSupport2.js" const y = x["my-fake-sym"]; >y : any >x["my-fake-sym"] : any ->x : any +>x : typeof x >"my-fake-sym" : "my-fake-sym" const z = x[x.S]; >z : any >x[x.S] : any ->x : any ->x.S : any ->x : any ->S : any +>x : typeof x +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport2.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +module.exports[_sym] = "ok"; +>module.exports[_sym] = "ok" : "ok" +>module.exports[_sym] : any +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>_sym : unique symbol +>"ok" : "ok" + +module.exports[_str] = "ok"; +>module.exports[_str] = "ok" : "ok" +>module.exports[_str] : any +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>_str : "my-fake-sym" +>"ok" : "ok" + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt index 22841144de..d65e4df9b2 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt @@ -1,12 +1,19 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. +usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. +usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. + Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -==== usage.js (1 errors) ==== +==== usage.js (2 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport3.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. const y = x["my-fake-sym"]; + ~~~~~~~~~~~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. +!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. const z = x[x.S]; + ~~~~~~ +!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. +!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. ==== lateBoundAssignmentDeclarationSupport3.js (0 errors) ==== // currently unsupported diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols index 3bae7cdc52..4fbeabef51 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols @@ -4,6 +4,7 @@ const x = require("./lateBoundAssignmentDeclarationSupport3.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport3.js" : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) @@ -12,5 +13,44 @@ const y = x["my-fake-sym"]; const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) + +=== lateBoundAssignmentDeclarationSupport3.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) + +Object.defineProperty(module.exports, _sym, { value: "ok" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 4, 45)) + +Object.defineProperty(module.exports, _str, { value: "ok" }); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 45)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff index 16ff912a82..34b9842a8a 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.symbols.diff @@ -5,50 +5,62 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport3.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport3.js" : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) const y = x["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) -@@= skipped -9, +8 lines =@@ +@@= skipped -9, +9 lines =@@ const z = x[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) -- --=== lateBoundAssignmentDeclarationSupport3.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) -- --Object.defineProperty(module.exports, _sym, { value: "ok" }); ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) + + === lateBoundAssignmentDeclarationSupport3.js === + // currently unsupported +@@= skipped -14, +14 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) + + Object.defineProperty(module.exports, _sym, { value: "ok" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 4, 45)) -- --Object.defineProperty(module.exports, _str, { value: "ok" }); ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 4, 45)) + + Object.defineProperty(module.exports, _str, { value: "ok" }); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->module.exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 45)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport3.js, 2, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 45)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport3", Decl(lateBoundAssignmentDeclarationSupport3.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport3.js, 5, 61)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport3.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types index 87a0d10171..9bf71295d4 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport3.types @@ -2,22 +2,68 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport3.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport3.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport3.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport3.js" : "./lateBoundAssignmentDeclarationSupport3.js" const y = x["my-fake-sym"]; >y : any >x["my-fake-sym"] : any ->x : any +>x : typeof x >"my-fake-sym" : "my-fake-sym" const z = x[x.S]; >z : any >x[x.S] : any ->x : any ->x.S : any ->x : any ->S : any +>x : typeof x +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport3.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +Object.defineProperty(module.exports, _sym, { value: "ok" }); +>Object.defineProperty(module.exports, _sym, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>_sym : unique symbol +>{ value: "ok" } : { value: string; } +>value : string +>"ok" : "ok" + +Object.defineProperty(module.exports, _str, { value: "ok" }); +>Object.defineProperty(module.exports, _str, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>_str : "my-fake-sym" +>{ value: "ok" } : { value: string; } +>value : string +>"ok" : "ok" + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt index c624243a82..6f68a5e892 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt @@ -1,15 +1,16 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport4.js(9,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport4.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. const inst = new x.F(); + ~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; const z = inst[x.S]; -==== lateBoundAssignmentDeclarationSupport4.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport4.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; @@ -19,6 +20,8 @@ usage.js(1,19): error TS7016: Could not find a declaration file for module './la F.prototype[_sym] = "ok"; F.prototype[_str] = "ok"; const inst = new F(); + ~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; const _z = inst[_sym]; module.exports.F = F; diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols index 634958287c..746adf1266 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols @@ -4,10 +4,13 @@ const x = require("./lateBoundAssignmentDeclarationSupport4.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport4.js" : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) @@ -16,5 +19,61 @@ const y = inst["my-fake-sym"]; const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) + +=== lateBoundAssignmentDeclarationSupport4.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) +} +F.prototype[_sym] = "ok"; +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) + +F.prototype[_str] = "ok"; +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + +const inst = new F(); +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + +const _y = inst[_str]; +>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport4.js, 9, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + +const _z = inst[_sym]; +>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff index 3f1e5d91a3..042e2bf43b 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.symbols.diff @@ -5,73 +5,70 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport4.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport4.js" : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) -@@= skipped -15, +12 lines =@@ +@@= skipped -15, +15 lines =@@ const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) -- --=== lateBoundAssignmentDeclarationSupport4.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) -- --function F() { -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) --} --F.prototype[_sym] = "ok"; ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) + + === lateBoundAssignmentDeclarationSupport4.js === + // currently unsupported +@@= skipped -17, +17 lines =@@ + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + } + F.prototype[_sym] = "ok"; ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) -- --F.prototype[_str] = "ok"; ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) + + F.prototype[_str] = "ok"; ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) -- --const inst = new F(); -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) -- --const _y = inst[_str]; -->_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport4.js, 9, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) -- --const _z = inst[_sym]; -->_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport4.js, 8, 5)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 5)) + + const inst = new F(); +@@= skipped -27, +27 lines =@@ + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport4.js, 2, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport4.js, 10, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport4", Decl(lateBoundAssignmentDeclarationSupport4.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport4.js, 11, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport4.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types index 123e4b405c..5c0e03443a 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport4.types @@ -2,17 +2,17 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport4.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport4.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport4.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport4.js" : "./lateBoundAssignmentDeclarationSupport4.js" const inst = new x.F(); >inst : any >new x.F() : any ->x.F : any ->x : any ->F : any +>x.F : () => void +>x : typeof x +>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -24,7 +24,74 @@ const z = inst[x.S]; >z : any >inst[x.S] : any >inst : any ->x.S : any ->x : any ->S : any +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport4.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : () => void +} +F.prototype[_sym] = "ok"; +>F.prototype[_sym] = "ok" : "ok" +>F.prototype[_sym] : any +>F.prototype : any +>F : () => void +>prototype : any +>_sym : unique symbol +>"ok" : "ok" + +F.prototype[_str] = "ok"; +>F.prototype[_str] = "ok" : "ok" +>F.prototype[_str] : any +>F.prototype : any +>F : () => void +>prototype : any +>_str : "my-fake-sym" +>"ok" : "ok" + +const inst = new F(); +>inst : any +>new F() : any +>F : () => void + +const _y = inst[_str]; +>_y : any +>inst[_str] : any +>inst : any +>_str : "my-fake-sym" + +const _z = inst[_sym]; +>_z : any +>inst[_sym] : any +>inst : any +>_sym : unique symbol + +module.exports.F = F; +>module.exports.F = F : () => void +>module.exports.F : () => void +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>F : () => void +>F : () => void + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt index cf072d5f16..356f94438c 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt @@ -1,15 +1,16 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport5.js(11,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport5.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. const inst = new x.F(); + ~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; const z = inst[x.S]; -==== lateBoundAssignmentDeclarationSupport5.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport5.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; @@ -21,6 +22,8 @@ usage.js(1,19): error TS7016: Could not find a declaration file for module './la [_str]: "ok" } const inst = new F(); + ~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; const _z = inst[_sym]; module.exports.F = F; diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols index 46fc5ab27a..dfec96506b 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols @@ -4,10 +4,13 @@ const x = require("./lateBoundAssignmentDeclarationSupport5.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport5.js" : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) @@ -16,5 +19,62 @@ const y = inst["my-fake-sym"]; const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) + +=== lateBoundAssignmentDeclarationSupport5.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) +} +F.prototype = { +>F.prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) + + [_sym]: "ok", +>[_sym] : Symbol([_sym], Decl(lateBoundAssignmentDeclarationSupport5.js, 6, 15)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) + + [_str]: "ok" +>[_str] : Symbol([_str], Decl(lateBoundAssignmentDeclarationSupport5.js, 7, 17)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) +} +const inst = new F(); +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + +const _y = inst[_str]; +>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport5.js, 11, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) + +const _z = inst[_sym]; +>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff index abbbbe872f..affd1d4a62 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.symbols.diff @@ -5,74 +5,77 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport5.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport5.js" : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) -@@= skipped -15, +12 lines =@@ +@@= skipped -15, +15 lines =@@ const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) -- --=== lateBoundAssignmentDeclarationSupport5.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) -- --function F() { ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) + + === lateBoundAssignmentDeclarationSupport5.js === + // currently unsupported +@@= skipped -14, +14 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) + + function F() { ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) --} --F.prototype = { ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + } + F.prototype = { ->F.prototype : Symbol(F.prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) ->prototype : Symbol(F.prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) -- -- [_sym]: "ok", -->[_sym] : Symbol([_sym], Decl(lateBoundAssignmentDeclarationSupport5.js, 6, 15)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) -- -- [_str]: "ok" -->[_str] : Symbol([_str], Decl(lateBoundAssignmentDeclarationSupport5.js, 7, 17)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) --} --const inst = new F(); -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) ++>F.prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) ++>prototype : Symbol(prototype, Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) + + [_sym]: "ok", + >[_sym] : Symbol([_sym], Decl(lateBoundAssignmentDeclarationSupport5.js, 6, 15)) +@@= skipped -17, +17 lines =@@ + } + const inst = new F(); + >inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) -- --const _y = inst[_str]; -->_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport5.js, 11, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 5)) -- --const _z = inst[_sym]; -->_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport5.js, 10, 5)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + + const _y = inst[_str]; + >_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport5.js, 11, 5)) +@@= skipped -14, +14 lines =@@ + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27), Decl(lateBoundAssignmentDeclarationSupport5.js, 5, 1)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport5.js, 2, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport5.js, 12, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport5", Decl(lateBoundAssignmentDeclarationSupport5.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport5.js, 13, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport5.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types index f01b6acab6..efb0a174d2 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport5.types @@ -2,17 +2,17 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport5.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport5.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport5.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport5.js" : "./lateBoundAssignmentDeclarationSupport5.js" const inst = new x.F(); >inst : any >new x.F() : any ->x.F : any ->x : any ->F : any +>x.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>x : typeof x +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } const y = inst["my-fake-sym"]; >y : any @@ -24,7 +24,73 @@ const z = inst[x.S]; >z : any >inst[x.S] : any >inst : any ->x.S : any ->x : any ->S : any +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport5.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +} +F.prototype = { +>F.prototype = { [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } +>F.prototype : { [_sym]: string; "my-fake-sym": string; } +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>prototype : { [_sym]: string; "my-fake-sym": string; } +>{ [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } + + [_sym]: "ok", +>[_sym] : string +>_sym : unique symbol +>"ok" : "ok" + + [_str]: "ok" +>[_str] : string +>_str : "my-fake-sym" +>"ok" : "ok" +} +const inst = new F(); +>inst : any +>new F() : any +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + +const _y = inst[_str]; +>_y : any +>inst[_str] : any +>inst : any +>_str : "my-fake-sym" + +const _z = inst[_sym]; +>_z : any +>inst[_sym] : any +>inst : any +>_sym : unique symbol + +module.exports.F = F; +>module.exports.F = F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>module.exports.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } +>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt index f0ded7fc59..f178d33b5d 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt @@ -1,15 +1,16 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. +lateBoundAssignmentDeclarationSupport6.js(10,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. +usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport6.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. const inst = new x.F(); + ~~~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; const z = inst[x.S]; -==== lateBoundAssignmentDeclarationSupport6.js (0 errors) ==== +==== lateBoundAssignmentDeclarationSupport6.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; @@ -20,6 +21,8 @@ usage.js(1,19): error TS7016: Could not find a declaration file for module './la Object.defineProperty(F.prototype, _str, {value: "ok"}); Object.defineProperty(F.prototype, _sym, {value: "ok"}); const inst = new F(); + ~~~~~~~ +!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; const _z = inst[_sym]; module.exports.F = F; diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols index 01aaa40dfd..0262cf32be 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols @@ -4,10 +4,13 @@ const x = require("./lateBoundAssignmentDeclarationSupport6.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport6.js" : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) @@ -16,5 +19,74 @@ const y = inst["my-fake-sym"]; const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) + +=== lateBoundAssignmentDeclarationSupport6.js === +// currently unsupported +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +} +F.prototype.defsAClass = true; +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + +Object.defineProperty(F.prototype, _str, {value: "ok"}); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 7, 42)) + +Object.defineProperty(F.prototype, _sym, {value: "ok"}); +>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) +>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) +>value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 8, 42)) + +const inst = new F(); +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + +const _y = inst[_str]; +>_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport6.js, 10, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) + +const _z = inst[_sym]; +>_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 5)) +>inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff index eb78fefdea..ee8cda6b2e 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.symbols.diff @@ -5,87 +5,89 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport6.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport6.js" : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) const inst = new x.F(); >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) const y = inst["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 2, 5)) -@@= skipped -15, +12 lines =@@ +@@= skipped -15, +15 lines =@@ const z = inst[x.S]; >z : Symbol(z, Decl(usage.js, 3, 5)) >inst : Symbol(inst, Decl(usage.js, 1, 5)) ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) -- --=== lateBoundAssignmentDeclarationSupport6.js === --// currently unsupported --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) -- --function F() { -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) --} --F.prototype.defsAClass = true; ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) + + === lateBoundAssignmentDeclarationSupport6.js === + // currently unsupported +@@= skipped -17, +17 lines =@@ + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + } + F.prototype.defsAClass = true; ->F.prototype : Symbol(F.defsAClass, Decl(lateBoundAssignmentDeclarationSupport6.js, 5, 1)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->defsAClass : Symbol(F.defsAClass, Decl(lateBoundAssignmentDeclarationSupport6.js, 5, 1)) -- --Object.defineProperty(F.prototype, _str, {value: "ok"}); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + + Object.defineProperty(F.prototype, _str, {value: "ok"}); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 7, 42)) -- --Object.defineProperty(F.prototype, _sym, {value: "ok"}); ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 7, 42)) + + Object.defineProperty(F.prototype, _sym, {value: "ok"}); ->Object.defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) -->Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ++>Object.defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) + >Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) ->defineProperty : Symbol(ObjectConstructor.defineProperty, Decl(lib.es5.d.ts, --, --)) ->F.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ++>defineProperty : Symbol(defineProperty, Decl(lib.es5.d.ts, --, --)) ++>F.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) -->value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 8, 42)) -- --const inst = new F(); -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) -- --const _y = inst[_str]; -->_y : Symbol(_y, Decl(lateBoundAssignmentDeclarationSupport6.js, 10, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 5)) -- --const _z = inst[_sym]; -->_z : Symbol(_z, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 5)) -->inst : Symbol(inst, Decl(lateBoundAssignmentDeclarationSupport6.js, 9, 5)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) + >value : Symbol(value, Decl(lateBoundAssignmentDeclarationSupport6.js, 8, 42)) + +@@= skipped -41, +40 lines =@@ + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport6.js, 2, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport6.js, 11, 22)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport6", Decl(lateBoundAssignmentDeclarationSupport6.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport6.js, 12, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport6.js, 1, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types index d59bee28f5..011fe06265 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport6.types @@ -2,17 +2,17 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport6.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport6.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport6.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport6.js" : "./lateBoundAssignmentDeclarationSupport6.js" const inst = new x.F(); >inst : any >new x.F() : any ->x.F : any ->x : any ->F : any +>x.F : () => void +>x : typeof x +>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -24,7 +24,91 @@ const z = inst[x.S]; >z : any >inst[x.S] : any >inst : any ->x.S : any ->x : any ->S : any +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport6.js === +// currently unsupported +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : () => void +} +F.prototype.defsAClass = true; +>F.prototype.defsAClass = true : true +>F.prototype.defsAClass : any +>F.prototype : any +>F : () => void +>prototype : any +>defsAClass : any +>true : true + +Object.defineProperty(F.prototype, _str, {value: "ok"}); +>Object.defineProperty(F.prototype, _str, {value: "ok"}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>F.prototype : any +>F : () => void +>prototype : any +>_str : "my-fake-sym" +>{value: "ok"} : { value: string; } +>value : string +>"ok" : "ok" + +Object.defineProperty(F.prototype, _sym, {value: "ok"}); +>Object.defineProperty(F.prototype, _sym, {value: "ok"}) : any +>Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>Object : ObjectConstructor +>defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +>F.prototype : any +>F : () => void +>prototype : any +>_sym : unique symbol +>{value: "ok"} : { value: string; } +>value : string +>"ok" : "ok" + +const inst = new F(); +>inst : any +>new F() : any +>F : () => void + +const _y = inst[_str]; +>_y : any +>inst[_str] : any +>inst : any +>_str : "my-fake-sym" + +const _z = inst[_sym]; +>_z : any +>inst[_sym] : any +>inst : any +>_sym : unique symbol + +module.exports.F = F; +>module.exports.F = F : () => void +>module.exports.F : () => void +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>F : () => void +>F : () => void + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt deleted file mode 100644 index acaa5d43eb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. - - -==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport7.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. - const y = x.F["my-fake-sym"]; - const z = x.F[x.S]; - -==== lateBoundAssignmentDeclarationSupport7.js (0 errors) ==== - const _sym = Symbol(); - const _str = "my-fake-sym"; - - function F() { - } - F[_sym] = "ok"; - F[_str] = "ok"; - module.exports.F = F; - module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols index 91ccf436fb..c240506a8e 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols @@ -4,13 +4,56 @@ const x = require("./lateBoundAssignmentDeclarationSupport7.js"); >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) +>"./lateBoundAssignmentDeclarationSupport7.js" : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) const y = x.F["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>"my-fake-sym" : Symbol(F[_str], Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) const z = x.F[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) +>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) >x : Symbol(x, Decl(usage.js, 0, 5)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) + +=== lateBoundAssignmentDeclarationSupport7.js === +const _sym = Symbol(); +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) +>Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) + +const _str = "my-fake-sym"; +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + +function F() { +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) +} +F[_sym] = "ok"; +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) + +F[_str] = "ok"; +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) +>_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + +module.exports.F = F; +>module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) +>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + +module.exports.S = _sym; +>module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) +>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) +>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) +>_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff index d89e300c18..607ea8926c 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.symbols.diff @@ -5,13 +5,17 @@ >x : Symbol(x, Decl(usage.js, 0, 5)) >require : Symbol(require) ->"./lateBoundAssignmentDeclarationSupport7.js" : Symbol(x, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) ++>"./lateBoundAssignmentDeclarationSupport7.js" : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) const y = x.F["my-fake-sym"]; >y : Symbol(y, Decl(usage.js, 1, 5)) ->x.F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) >x : Symbol(x, Decl(usage.js, 0, 5)) ->F : Symbol(x.F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->"my-fake-sym" : Symbol(x.F.F[_str], Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>"my-fake-sym" : Symbol(F[_str], Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) const z = x.F[x.S]; >z : Symbol(z, Decl(usage.js, 2, 5)) @@ -21,40 +25,51 @@ ->x.S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ->x : Symbol(x, Decl(usage.js, 0, 5)) ->S : Symbol(x.S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) -- --=== lateBoundAssignmentDeclarationSupport7.js === --const _sym = Symbol(); -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) -->Symbol : Symbol(Symbol, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) -- --const _str = "my-fake-sym"; -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) -- --function F() { ++>x.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>x : Symbol(x, Decl(usage.js, 0, 5)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>x.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ++>x : Symbol(x, Decl(usage.js, 0, 5)) ++>S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) + + === lateBoundAssignmentDeclarationSupport7.js === + const _sym = Symbol(); +@@= skipped -27, +27 lines =@@ + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + + function F() { ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) --} --F[_sym] = "ok"; ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + } + F[_sym] = "ok"; ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) -- --F[_str] = "ok"; ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) + + F[_str] = "ok"; ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) -->_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) -- --module.exports.F = F; -->module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + >_str : Symbol(_str, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 5)) + + module.exports.F = F; + >module.exports.F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->module.exports : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) -->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) + >F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27), Decl(lateBoundAssignmentDeclarationSupport7.js, 4, 1), Decl(lateBoundAssignmentDeclarationSupport7.js, 5, 15)) -- --module.exports.S = _sym; -->module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ++>F : Symbol(F, Decl(lateBoundAssignmentDeclarationSupport7.js, 1, 27)) + + module.exports.S = _sym; + >module.exports.S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ->module.exports : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) ->module : Symbol(module, Decl(lateBoundAssignmentDeclarationSupport7.js, 6, 15)) ->exports : Symbol(module.exports, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) -->S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) -->_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) -+>x : Symbol(x, Decl(usage.js, 0, 5)) -+>x : Symbol(x, Decl(usage.js, 0, 5)) ++>module.exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("lateBoundAssignmentDeclarationSupport7", Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 0)) + >S : Symbol(S, Decl(lateBoundAssignmentDeclarationSupport7.js, 7, 21)) + >_sym : Symbol(_sym, Decl(lateBoundAssignmentDeclarationSupport7.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types index 450a5a61c7..7c3a480473 100644 --- a/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types +++ b/testdata/baselines/reference/submodule/conformance/lateBoundAssignmentDeclarationSupport7.types @@ -2,26 +2,71 @@ === usage.js === const x = require("./lateBoundAssignmentDeclarationSupport7.js"); ->x : any ->require("./lateBoundAssignmentDeclarationSupport7.js") : any +>x : typeof x +>require("./lateBoundAssignmentDeclarationSupport7.js") : typeof x >require : any >"./lateBoundAssignmentDeclarationSupport7.js" : "./lateBoundAssignmentDeclarationSupport7.js" const y = x.F["my-fake-sym"]; ->y : any ->x.F["my-fake-sym"] : any ->x.F : any ->x : any ->F : any +>y : string +>x.F["my-fake-sym"] : string +>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } +>x : typeof x +>F : { (): void; [_sym]: string; "my-fake-sym": string; } >"my-fake-sym" : "my-fake-sym" const z = x.F[x.S]; ->z : any ->x.F[x.S] : any ->x.F : any ->x : any ->F : any ->x.S : any ->x : any ->S : any +>z : string +>x.F[x.S] : string +>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } +>x : typeof x +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>x.S : unique symbol +>x : typeof x +>S : unique symbol + +=== lateBoundAssignmentDeclarationSupport7.js === +const _sym = Symbol(); +>_sym : unique symbol +>Symbol() : unique symbol +>Symbol : SymbolConstructor + +const _str = "my-fake-sym"; +>_str : "my-fake-sym" +>"my-fake-sym" : "my-fake-sym" + +function F() { +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +} +F[_sym] = "ok"; +>F[_sym] = "ok" : "ok" +>F[_sym] : string +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>_sym : unique symbol +>"ok" : "ok" + +F[_str] = "ok"; +>F[_str] = "ok" : "ok" +>F[_str] : string +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>_str : "my-fake-sym" +>"ok" : "ok" + +module.exports.F = F; +>module.exports.F = F : { (): void; [_sym]: string; "my-fake-sym": string; } +>module.exports.F : { (): void; [_sym]: string; "my-fake-sym": string; } +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>F : { (): void; [_sym]: string; "my-fake-sym": string; } +>F : { (): void; [_sym]: string; "my-fake-sym": string; } + +module.exports.S = _sym; +>module.exports.S = _sym : unique symbol +>module.exports.S : unique symbol +>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } +>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") +>S : unique symbol +>_sym : unique symbol diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.errors.txt new file mode 100644 index 0000000000..5722991ad9 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.errors.txt @@ -0,0 +1,30 @@ +index.js(4,13): error TS2351: This expression is not constructable. + Type 'typeof import("semver")' has no construct signatures. +semver.js(2,1): error TS2631: Cannot assign to '"semver"' because it is a namespace. +semver.js(2,11): error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. + + +==== index.js (1 errors) ==== + /// + const C = require("./semver") + var two = C.f(1) + var c = new C + ~ +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'typeof import("semver")' has no construct signatures. + +==== node.d.ts (0 errors) ==== + declare function require(name: string): any; + declare var exports: any; + declare var module: { exports: any }; +==== semver.js (2 errors) ==== + /// + exports = module.exports = C + ~~~~~~~ +!!! error TS2631: Cannot assign to '"semver"' because it is a namespace. + ~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. + exports.f = n => n + 1 + function C() { + this.p = 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols index 3d87d7dd5c..e185fa60f0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols @@ -5,10 +5,13 @@ const C = require("./semver") >C : Symbol(C, Decl(index.js, 1, 5)) >require : Symbol(require, Decl(node.d.ts, 0, 0)) +>"./semver" : Symbol("semver", Decl(semver.js, 0, 0)) var two = C.f(1) >two : Symbol(two, Decl(index.js, 2, 3)) +>C.f : Symbol(f, Decl(semver.js, 1, 28)) >C : Symbol(C, Decl(index.js, 1, 5)) +>f : Symbol(f, Decl(semver.js, 1, 28)) var c = new C >c : Symbol(c, Decl(index.js, 3, 3)) @@ -26,3 +29,24 @@ declare var module: { exports: any }; >module : Symbol(module, Decl(node.d.ts, 2, 11)) >exports : Symbol(exports, Decl(node.d.ts, 2, 21)) +=== semver.js === +/// +exports = module.exports = C +>exports : Symbol("semver", Decl(semver.js, 0, 0)) +>module.exports : Symbol("semver", Decl(semver.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("semver", Decl(semver.js, 0, 0)) +>C : Symbol(C, Decl(semver.js, 2, 22)) + +exports.f = n => n + 1 +>exports.f : Symbol(f, Decl(semver.js, 1, 28)) +>exports : Symbol("semver", Decl(semver.js, 0, 0)) +>f : Symbol(f, Decl(semver.js, 1, 28)) +>n : Symbol(n, Decl(semver.js, 2, 11)) +>n : Symbol(n, Decl(semver.js, 2, 11)) + +function C() { +>C : Symbol(C, Decl(semver.js, 2, 22)) + + this.p = 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff index 1474a9199b..b00ecd13da 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.symbols.diff @@ -1,44 +1,41 @@ --- old.moduleExportAlias2.symbols +++ new.moduleExportAlias2.symbols -@@= skipped -4, +4 lines =@@ - const C = require("./semver") - >C : Symbol(C, Decl(index.js, 1, 5)) - >require : Symbol(require, Decl(node.d.ts, 0, 0)) -->"./semver" : Symbol("semver", Decl(semver.js, 0, 0)) +@@= skipped -8, +8 lines =@@ var two = C.f(1) >two : Symbol(two, Decl(index.js, 2, 3)) ->C.f : Symbol(C.f, Decl(semver.js, 1, 28)) ++>C.f : Symbol(f, Decl(semver.js, 1, 28)) >C : Symbol(C, Decl(index.js, 1, 5)) ->f : Symbol(C.f, Decl(semver.js, 1, 28)) ++>f : Symbol(f, Decl(semver.js, 1, 28)) var c = new C >c : Symbol(c, Decl(index.js, 3, 3)) -@@= skipped -24, +21 lines =@@ - >module : Symbol(module, Decl(node.d.ts, 2, 11)) - >exports : Symbol(exports, Decl(node.d.ts, 2, 21)) - --=== semver.js === --/// --exports = module.exports = C -->exports : Symbol("semver", Decl(semver.js, 0, 0)) +@@= skipped -24, +24 lines =@@ + /// + exports = module.exports = C + >exports : Symbol("semver", Decl(semver.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(semver.js, 0, 0)) ->module : Symbol(export=, Decl(semver.js, 1, 9)) ->exports : Symbol(export=, Decl(semver.js, 1, 9)) -->C : Symbol(C, Decl(semver.js, 2, 22)) -- --exports.f = n => n + 1 -->exports.f : Symbol(f, Decl(semver.js, 1, 28)) ++>module.exports : Symbol("semver", Decl(semver.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("semver", Decl(semver.js, 0, 0)) + >C : Symbol(C, Decl(semver.js, 2, 22)) + + exports.f = n => n + 1 + >exports.f : Symbol(f, Decl(semver.js, 1, 28)) ->exports : Symbol(f, Decl(semver.js, 1, 28)) -->f : Symbol(f, Decl(semver.js, 1, 28)) -->n : Symbol(n, Decl(semver.js, 2, 11)) -->n : Symbol(n, Decl(semver.js, 2, 11)) -- --function C() { -->C : Symbol(C, Decl(semver.js, 2, 22)) -- -- this.p = 1 ++>exports : Symbol("semver", Decl(semver.js, 0, 0)) + >f : Symbol(f, Decl(semver.js, 1, 28)) + >n : Symbol(n, Decl(semver.js, 2, 11)) + >n : Symbol(n, Decl(semver.js, 2, 11)) +@@= skipped -16, +16 lines =@@ + >C : Symbol(C, Decl(semver.js, 2, 22)) + + this.p = 1 ->this.p : Symbol(C.p, Decl(semver.js, 3, 14)) ->this : Symbol(C, Decl(semver.js, 2, 22)) ->p : Symbol(C.p, Decl(semver.js, 3, 14)) --} \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types index d244428cea..8ec634b4d0 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAlias2.types @@ -3,23 +3,23 @@ === index.js === /// const C = require("./semver") ->C : any ->require("./semver") : any +>C : typeof C +>require("./semver") : typeof C >require : (name: string) => any >"./semver" : "./semver" var two = C.f(1) >two : any >C.f(1) : any ->C.f : any ->C : any ->f : any +>C.f : (n: any) => any +>C : typeof C +>f : (n: any) => any >1 : 1 var c = new C >c : any >new C : any ->C : any +>C : typeof C === node.d.ts === declare function require(name: string): any; @@ -33,3 +33,35 @@ declare var module: { exports: any }; >module : { exports: any; } >exports : any +=== semver.js === +/// +exports = module.exports = C +>exports = module.exports = C : () => void +>exports : any +>module.exports = C : () => void +>module.exports : typeof import("./semver") +>module : { "\"semver\"": typeof import("./semver"); } +>exports : typeof import("./semver") +>C : () => void + +exports.f = n => n + 1 +>exports.f = n => n + 1 : (n: any) => any +>exports.f : (n: any) => any +>exports : typeof import("./semver") +>f : (n: any) => any +>n => n + 1 : (n: any) => any +>n : any +>n + 1 : any +>n : any +>1 : 1 + +function C() { +>C : () => void + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.errors.txt new file mode 100644 index 0000000000..8472709b9b --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.errors.txt @@ -0,0 +1,44 @@ +npmlog.js(5,14): error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. +npmlog.js(8,16): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. +npmlog.js(10,8): error TS2339: Property 'x' does not exist on type 'EE'. +npmlog.js(12,8): error TS2339: Property 'y' does not exist on type 'EE'. +npmlog.js(13,16): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. +use.js(2,8): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. +use.js(3,8): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. + + +==== use.js (2 errors) ==== + var npmlog = require('./npmlog') + npmlog.x + ~ +!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. + npmlog.on + ~~ +!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. + +==== npmlog.js (5 errors) ==== + class EE { + /** @param {string} s */ + on(s) { } + } + var npmlog = module.exports = new EE() + ~~~~~~~~~~~~~~ +!!! error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. +!!! related TS2728 npmlog.js:11:1: 'y' is declared here. + + npmlog.on('hi') // both references should see EE.on + module.exports.on('hi') // here too + ~~ +!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. + + npmlog.x = 1 + ~ +!!! error TS2339: Property 'x' does not exist on type 'EE'. + module.exports.y = 2 + npmlog.y + ~ +!!! error TS2339: Property 'y' does not exist on type 'EE'. + module.exports.x + ~ +!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols index dce06dcac9..30d662f4bb 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols @@ -4,6 +4,7 @@ var npmlog = require('./npmlog') >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./npmlog' : Symbol("npmlog", Decl(npmlog.js, 0, 0)) npmlog.x >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) @@ -11,3 +12,47 @@ npmlog.x npmlog.on >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) +=== npmlog.js === +class EE { +>EE : Symbol(EE, Decl(npmlog.js, 0, 0)) + + /** @param {string} s */ + on(s) { } +>on : Symbol(on, Decl(npmlog.js, 0, 10)) +>s : Symbol(s, Decl(npmlog.js, 2, 7)) +} +var npmlog = module.exports = new EE() +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>EE : Symbol(EE, Decl(npmlog.js, 0, 0)) + +npmlog.on('hi') // both references should see EE.on +>npmlog.on : Symbol(on, Decl(npmlog.js, 0, 10)) +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) +>on : Symbol(on, Decl(npmlog.js, 0, 10)) + +module.exports.on('hi') // here too +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + +npmlog.x = 1 +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + +module.exports.y = 2 +>module.exports.y : Symbol(y, Decl(npmlog.js, 9, 12)) +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>y : Symbol(y, Decl(npmlog.js, 9, 12)) + +npmlog.y +>npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + +module.exports.x +>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff index 5400f170be..7b555ee6d6 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.symbols.diff @@ -1,10 +1,7 @@ --- old.moduleExportAssignment.symbols +++ new.moduleExportAssignment.symbols -@@= skipped -3, +3 lines =@@ - var npmlog = require('./npmlog') - >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) - >require : Symbol(require) -->'./npmlog' : Symbol("npmlog", Decl(npmlog.js, 0, 0)) +@@= skipped -6, +6 lines =@@ + >'./npmlog' : Symbol("npmlog", Decl(npmlog.js, 0, 0)) npmlog.x ->npmlog.x : Symbol(npmlog.x, Decl(npmlog.js, 7, 23)) @@ -15,55 +12,70 @@ ->npmlog.on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) >npmlog : Symbol(npmlog, Decl(use.js, 0, 3)) ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -- --=== npmlog.js === --class EE { -->EE : Symbol(EE, Decl(npmlog.js, 0, 0)) -- -- /** @param {string} s */ -- on(s) { } + + === npmlog.js === + class EE { +@@= skipped -15, +11 lines =@@ + + /** @param {string} s */ + on(s) { } ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -->s : Symbol(s, Decl(npmlog.js, 2, 7)) --} --var npmlog = module.exports = new EE() -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ++>on : Symbol(on, Decl(npmlog.js, 0, 10)) + >s : Symbol(s, Decl(npmlog.js, 2, 7)) + } + var npmlog = module.exports = new EE() + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->module.exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->module : Symbol(npmlog, Decl(npmlog.js, 4, 12)) ->exports : Symbol(npmlog, Decl(npmlog.js, 4, 12)) -->EE : Symbol(EE, Decl(npmlog.js, 0, 0)) -- --npmlog.on('hi') // both references should see EE.on ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + >EE : Symbol(EE, Decl(npmlog.js, 0, 0)) + + npmlog.on('hi') // both references should see EE.on ->npmlog.on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ++>npmlog.on : Symbol(on, Decl(npmlog.js, 0, 10)) + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -- --module.exports.on('hi') // here too ++>on : Symbol(on, Decl(npmlog.js, 0, 10)) + + module.exports.on('hi') // here too ->module.exports.on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) ->module.exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->module : Symbol(module, Decl(npmlog.js, 4, 12)) ->exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->on : Symbol(EE.on, Decl(npmlog.js, 0, 10)) -- --npmlog.x = 1 ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + + npmlog.x = 1 ->npmlog.x : Symbol(x, Decl(npmlog.js, 7, 23)) -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->x : Symbol(x, Decl(npmlog.js, 7, 23)) -- --module.exports.y = 2 -->module.exports.y : Symbol(y, Decl(npmlog.js, 9, 12)) + + module.exports.y = 2 + >module.exports.y : Symbol(y, Decl(npmlog.js, 9, 12)) ->module.exports : Symbol(y, Decl(npmlog.js, 9, 12)) ->module : Symbol(module, Decl(npmlog.js, 4, 12)) ->exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) -->y : Symbol(y, Decl(npmlog.js, 9, 12)) -- --npmlog.y ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) + >y : Symbol(y, Decl(npmlog.js, 9, 12)) + + npmlog.y ->npmlog.y : Symbol(y, Decl(npmlog.js, 9, 12)) -->npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) + >npmlog : Symbol(npmlog, Decl(npmlog.js, 4, 3)) ->y : Symbol(y, Decl(npmlog.js, 9, 12)) -- --module.exports.x + + module.exports.x ->module.exports.x : Symbol(x, Decl(npmlog.js, 7, 23)) ->module.exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->module : Symbol(module, Decl(npmlog.js, 4, 12)) ->exports : Symbol(module.exports, Decl(npmlog.js, 0, 0)) ->x : Symbol(x, Decl(npmlog.js, 7, 23)) ++>module.exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("npmlog", Decl(npmlog.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types index 052763ea5d..9c6bdfc605 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment.types @@ -2,18 +2,80 @@ === use.js === var npmlog = require('./npmlog') ->npmlog : any ->require('./npmlog') : any +>npmlog : typeof npmlog +>require('./npmlog') : typeof npmlog >require : any >'./npmlog' : "./npmlog" npmlog.x >npmlog.x : any ->npmlog : any +>npmlog : typeof npmlog >x : any npmlog.on >npmlog.on : any ->npmlog : any +>npmlog : typeof npmlog >on : any +=== npmlog.js === +class EE { +>EE : EE + + /** @param {string} s */ + on(s) { } +>on : (s: string) => void +>s : string +} +var npmlog = module.exports = new EE() +>npmlog : EE +>module.exports = new EE() : EE +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>new EE() : EE +>EE : typeof EE + +npmlog.on('hi') // both references should see EE.on +>npmlog.on('hi') : void +>npmlog.on : (s: string) => void +>npmlog : EE +>on : (s: string) => void +>'hi' : "hi" + +module.exports.on('hi') // here too +>module.exports.on('hi') : any +>module.exports.on : any +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>on : any +>'hi' : "hi" + +npmlog.x = 1 +>npmlog.x = 1 : 1 +>npmlog.x : any +>npmlog : EE +>x : any +>1 : 1 + +module.exports.y = 2 +>module.exports.y = 2 : 2 +>module.exports.y : 2 +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>y : 2 +>2 : 2 + +npmlog.y +>npmlog.y : any +>npmlog : EE +>y : any + +module.exports.x +>module.exports.x : any +>module.exports : typeof import("./npmlog") +>module : { "\"npmlog\"": typeof import("./npmlog"); } +>exports : typeof import("./npmlog") +>x : any + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols index b1bfa5de45..6c48dba82f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols @@ -4,7 +4,20 @@ var mod = require('./mod') >mod : Symbol(mod, Decl(npm.js, 0, 3)) >require : Symbol(require) +>'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) mod() // should be callable from here too >mod : Symbol(mod, Decl(npm.js, 0, 3)) +=== mod.js === +module.exports = function x() { } +>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod.js, 0, 0)) +>x : Symbol(x, Decl(mod.js, 0, 16)) + +module.exports() // should be callable +>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff index 3ff285b58a..8f69b075c9 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.symbols.diff @@ -1,22 +1,20 @@ --- old.moduleExportAssignment3.symbols +++ new.moduleExportAssignment3.symbols -@@= skipped -3, +3 lines =@@ - var mod = require('./mod') - >mod : Symbol(mod, Decl(npm.js, 0, 3)) - >require : Symbol(require) -->'./mod' : Symbol("mod", Decl(mod.js, 0, 0)) +@@= skipped -10, +10 lines =@@ - mod() // should be callable from here too - >mod : Symbol(mod, Decl(npm.js, 0, 3)) -- --=== mod.js === --module.exports = function x() { } + === mod.js === + module.exports = function x() { } ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(export=, Decl(mod.js, 0, 0)) -->exports : Symbol(export=, Decl(mod.js, 0, 0)) -->x : Symbol(x, Decl(mod.js, 0, 16)) -- --module.exports() // should be callable ++>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod.js, 0, 0)) + >x : Symbol(x, Decl(mod.js, 0, 16)) + + module.exports() // should be callable ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(module, Decl(mod.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ++>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types index 1bcd664346..c65733a126 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportAssignment3.types @@ -2,12 +2,27 @@ === npm.js === var mod = require('./mod') ->mod : any ->require('./mod') : any +>mod : () => void +>require('./mod') : () => void >require : any >'./mod' : "./mod" mod() // should be callable from here too ->mod() : any ->mod : any +>mod() : void +>mod : () => void + +=== mod.js === +module.exports = function x() { } +>module.exports = function x() { } : () => void +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void +>function x() { } : () => void +>x : () => void + +module.exports() // should be callable +>module.exports() : void +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt index c04c7d2d59..255fc59d83 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.errors.txt @@ -1,16 +1,31 @@ -test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. +moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(3,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. apply() + ~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (0 errors) ==== +==== moduleExportAliasDuplicateAlias.js (5 errors) ==== exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } exports.apply() + ~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. exports.apply = a; + ~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply() + ~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols index 437998041f..330ee93fa9 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols @@ -4,7 +4,34 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') >apply : Symbol(apply, Decl(test.js, 0, 7)) >require : Symbol(require) +>'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) apply() >apply : Symbol(apply, Decl(test.js, 0, 7)) +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>undefined : Symbol(undefined) + +function a() { } +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) + +exports.apply() +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + +exports.apply = a; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) + +exports.apply() +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff index 2c13010298..dbca3c343a 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.symbols.diff @@ -1,36 +1,19 @@ --- old.moduleExportDuplicateAlias.symbols +++ new.moduleExportDuplicateAlias.symbols -@@= skipped -3, +3 lines =@@ - const { apply } = require('./moduleExportAliasDuplicateAlias') - >apply : Symbol(apply, Decl(test.js, 0, 7)) - >require : Symbol(require) -->'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) - - apply() - >apply : Symbol(apply, Decl(test.js, 0, 7)) -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) +@@= skipped -11, +11 lines =@@ + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->undefined : Symbol(undefined) -- --function a() { } -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) -- --exports.apply() -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -- --exports.apply = a; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + >undefined : Symbol(undefined) + +@@= skipped -14, +14 lines =@@ + + exports.apply = a; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) -- --exports.apply() -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 2, 15)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 26)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types index 0f5bbd9ace..ea268466c5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias.types @@ -2,12 +2,42 @@ === test.js === const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : any ->require('./moduleExportAliasDuplicateAlias') : any +>apply : undefined +>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() >apply() : any ->apply : any +>apply : undefined + +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply = undefined : undefined +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +function a() { } +>a : () => void + +exports.apply() +>exports.apply() : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined + +exports.apply = a; +>exports.apply = a : () => void +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +exports.apply() +>exports.apply() : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt index e5f740a3c9..f9fd9f7140 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.errors.txt @@ -1,16 +1,34 @@ -test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. +moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(3,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(3,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. apply() + ~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (0 errors) ==== +==== moduleExportAliasDuplicateAlias.js (6 errors) ==== module.exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } module.exports.apply = a; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. module.exports.apply = a; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. module.exports.apply() + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols index 1e416b02d9..6441cf72c8 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols @@ -4,7 +4,43 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') >apply : Symbol(apply, Decl(test.js, 0, 7)) >require : Symbol(require) +>'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) apply() >apply : Symbol(apply, Decl(test.js, 0, 7)) +=== moduleExportAliasDuplicateAlias.js === +module.exports.apply = undefined; +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>undefined : Symbol(undefined) + +function a() { } +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + +module.exports.apply = a; +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + +module.exports.apply = a; +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + +module.exports.apply() +>module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff index a779841c00..265c5d3763 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.symbols.diff @@ -1,45 +1,48 @@ --- old.moduleExportDuplicateAlias2.symbols +++ new.moduleExportDuplicateAlias2.symbols -@@= skipped -3, +3 lines =@@ - const { apply } = require('./moduleExportAliasDuplicateAlias') - >apply : Symbol(apply, Decl(test.js, 0, 7)) - >require : Symbol(require) -->'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) - - apply() - >apply : Symbol(apply, Decl(test.js, 0, 7)) -- --=== moduleExportAliasDuplicateAlias.js === --module.exports.apply = undefined; -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) +@@= skipped -11, +11 lines =@@ + === moduleExportAliasDuplicateAlias.js === + module.exports.apply = undefined; + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) -->undefined : Symbol(undefined) -- --function a() { } -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) -- --module.exports.apply = a; -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + >undefined : Symbol(undefined) + +@@= skipped -11, +11 lines =@@ + + module.exports.apply = a; + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) -- --module.exports.apply = a; -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + + module.exports.apply = a; + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) -- --module.exports.apply() -->module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 0, 33)) + + module.exports.apply() + >module.exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ->module.exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->module : Symbol(module, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ->exports : Symbol(module.exports, Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) ++>module.exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 1, 16), Decl(moduleExportAliasDuplicateAlias.js, 2, 25)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types index 5c02030b04..ff8d430fea 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias2.types @@ -2,12 +2,51 @@ === test.js === const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : any ->require('./moduleExportAliasDuplicateAlias') : any +>apply : undefined +>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() >apply() : any ->apply : any +>apply : undefined + +=== moduleExportAliasDuplicateAlias.js === +module.exports.apply = undefined; +>module.exports.apply = undefined : undefined +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +function a() { } +>a : () => void + +module.exports.apply = a; +>module.exports.apply = a : () => void +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +module.exports.apply = a; +>module.exports.apply = a : () => void +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +module.exports.apply() +>module.exports.apply() : any +>module.exports.apply : undefined +>module.exports : typeof import("./moduleExportAliasDuplicateAlias") +>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt index d50d647cff..f6d8b7f341 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.errors.txt @@ -1,19 +1,49 @@ -test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. +moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(2,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. +moduleExportAliasDuplicateAlias.js(6,1): error TS2322: Type '"ok"' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(6,1): error TS2323: Cannot redeclare exported variable 'apply'. +moduleExportAliasDuplicateAlias.js(7,10): error TS18048: 'exports.apply' is possibly 'undefined'. +moduleExportAliasDuplicateAlias.js(8,1): error TS2322: Type '1' is not assignable to type 'undefined'. +moduleExportAliasDuplicateAlias.js(8,1): error TS2323: Cannot redeclare exported variable 'apply'. +test.js(2,16): error TS18048: 'apply' is possibly 'undefined'. ==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. const result = apply.toFixed() + ~~~~~ +!!! error TS18048: 'apply' is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (0 errors) ==== +==== moduleExportAliasDuplicateAlias.js (10 errors) ==== exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply = undefined; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } exports.apply = a; + ~~~~~~~~~~~~~ +!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply() + ~~~~~~~~~~~~~ +!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. exports.apply = 'ok' + ~~~~~~~~~~~~~ +!!! error TS2322: Type '"ok"' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. var OK = exports.apply.toUpperCase() + ~~~~~~~~~~~~~ +!!! error TS18048: 'exports.apply' is possibly 'undefined'. exports.apply = 1 + ~~~~~~~~~~~~~ +!!! error TS2322: Type '1' is not assignable to type 'undefined'. + ~~~~~~~~~~~~~~~~~ +!!! error TS2323: Cannot redeclare exported variable 'apply'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols index f56e947274..8fb360fee5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols @@ -4,8 +4,52 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') >apply : Symbol(apply, Decl(test.js, 0, 7)) >require : Symbol(require) +>'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) const result = apply.toFixed() >result : Symbol(result, Decl(test.js, 1, 5)) >apply : Symbol(apply, Decl(test.js, 0, 7)) +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>undefined : Symbol(undefined) + +exports.apply = undefined; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>undefined : Symbol(undefined) + +function a() { } +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) + +exports.apply = a; +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) + +exports.apply() +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + +exports.apply = 'ok' +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + +var OK = exports.apply.toUpperCase() +>OK : Symbol(OK, Decl(moduleExportAliasDuplicateAlias.js, 6, 3)) +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + +exports.apply = 1 +>exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) +>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +>apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff index 627e9464a1..5e155e298c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.symbols.diff @@ -1,58 +1,55 @@ --- old.moduleExportDuplicateAlias3.symbols +++ new.moduleExportDuplicateAlias3.symbols -@@= skipped -3, +3 lines =@@ - const { apply } = require('./moduleExportAliasDuplicateAlias') - >apply : Symbol(apply, Decl(test.js, 0, 7)) - >require : Symbol(require) -->'./moduleExportAliasDuplicateAlias' : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) +@@= skipped -7, +7 lines =@@ const result = apply.toFixed() >result : Symbol(result, Decl(test.js, 1, 5)) ->apply.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) >apply : Symbol(apply, Decl(test.js, 0, 7)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->undefined : Symbol(undefined) -- --exports.apply = undefined; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >undefined : Symbol(undefined) + + exports.apply = undefined; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->undefined : Symbol(undefined) -- --function a() { } -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) -- --exports.apply = a; -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >undefined : Symbol(undefined) + +@@= skipped -22, +20 lines =@@ + + exports.apply = a; + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) -- --exports.apply() -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -- --exports.apply = 'ok' -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >a : Symbol(a, Decl(moduleExportAliasDuplicateAlias.js, 1, 26)) + +@@= skipped -11, +11 lines =@@ + + exports.apply = 'ok' + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -- --var OK = exports.apply.toUpperCase() -->OK : Symbol(OK, Decl(moduleExportAliasDuplicateAlias.js, 6, 3)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + + var OK = exports.apply.toUpperCase() + >OK : Symbol(OK, Decl(moduleExportAliasDuplicateAlias.js, 6, 3)) ->exports.apply.toUpperCase : Symbol(String.toUpperCase, Decl(lib.es5.d.ts, --, --)) -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + >exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->toUpperCase : Symbol(String.toUpperCase, Decl(lib.es5.d.ts, --, --)) -- --exports.apply = 1 -->exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) + + exports.apply = 1 + >exports.apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ->exports : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) -->apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) ++>exports : Symbol("moduleExportAliasDuplicateAlias", Decl(moduleExportAliasDuplicateAlias.js, 0, 0)) + >apply : Symbol(apply, Decl(moduleExportAliasDuplicateAlias.js, 0, 0), Decl(moduleExportAliasDuplicateAlias.js, 0, 26), Decl(moduleExportAliasDuplicateAlias.js, 2, 16), Decl(moduleExportAliasDuplicateAlias.js, 4, 15), Decl(moduleExportAliasDuplicateAlias.js, 6, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types index b85f61eb37..614318ae51 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportDuplicateAlias3.types @@ -2,8 +2,8 @@ === test.js === const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : any ->require('./moduleExportAliasDuplicateAlias') : any +>apply : undefined +>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" @@ -11,6 +11,60 @@ const result = apply.toFixed() >result : any >apply.toFixed() : any >apply.toFixed : any ->apply : any +>apply : undefined >toFixed : any +=== moduleExportAliasDuplicateAlias.js === +exports.apply = undefined; +>exports.apply = undefined : undefined +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +exports.apply = undefined; +>exports.apply = undefined : undefined +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>undefined : undefined + +function a() { } +>a : () => void + +exports.apply = a; +>exports.apply = a : () => void +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>a : () => void + +exports.apply() +>exports.apply() : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined + +exports.apply = 'ok' +>exports.apply = 'ok' : "ok" +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>'ok' : "ok" + +var OK = exports.apply.toUpperCase() +>OK : any +>exports.apply.toUpperCase() : any +>exports.apply.toUpperCase : any +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>toUpperCase : any + +exports.apply = 1 +>exports.apply = 1 : 1 +>exports.apply : undefined +>exports : typeof import("./moduleExportAliasDuplicateAlias") +>apply : undefined +>1 : 1 + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt new file mode 100644 index 0000000000..c062fa89da --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.errors.txt @@ -0,0 +1,26 @@ +a.js(4,6): error TS2339: Property 'f' does not exist on type '() => void'. +mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(4,16): error TS2339: Property 'f' does not exist on type '() => void'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1() + mod1.f() // error, not enough arguments + ~ +!!! error TS2339: Property 'f' does not exist on type '() => void'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (2 errors) ==== + /// + module.exports = function () { } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + /** @param {number} a */ + module.exports.f = function (a) { } + ~ +!!! error TS2339: Property 'f' does not exist on type '() => void'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols index e4165dbfd3..72949ef09f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols @@ -5,6 +5,7 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1() >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -21,3 +22,17 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports = function () { } +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + +/** @param {number} a */ +module.exports.f = function (a) { } +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>a : Symbol(a, Decl(mod1.js, 3, 29)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff index 162efce033..1f47a437b4 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.symbols.diff @@ -1,12 +1,6 @@ --- old.moduleExportWithExportPropertyAssignment.symbols +++ new.moduleExportWithExportPropertyAssignment.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) - - mod1() +@@= skipped -10, +10 lines =@@ >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) mod1.f() // error, not enough arguments @@ -16,23 +10,24 @@ === requires.d.ts === declare var module: { exports: any }; -@@= skipped -18, +15 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports = function () { } +@@= skipped -16, +14 lines =@@ + === mod1.js === + /// + module.exports = function () { } ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) -->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -- --/** @param {number} a */ --module.exports.f = function (a) { } ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod1.js, 0, 0)) + + /** @param {number} a */ + module.exports.f = function (a) { } ->module.exports.f : Symbol(f, Decl(mod1.js, 1, 32)) ->module.exports : Symbol(f, Decl(mod1.js, 1, 32)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->f : Symbol(f, Decl(mod1.js, 1, 32)) -->a : Symbol(a, Decl(mod1.js, 3, 29)) ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + >a : Symbol(a, Decl(mod1.js, 3, 29)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types index 7b6a08b939..ee42485873 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment.types @@ -3,19 +3,19 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : () => void +>require('./mod1') : () => void >require : (name: string) => any >'./mod1' : "./mod1" mod1() ->mod1() : any ->mod1 : any +>mod1() : void +>mod1 : () => void mod1.f() // error, not enough arguments >mod1.f() : any >mod1.f : any ->mod1 : any +>mod1 : () => void >f : any === requires.d.ts === @@ -27,3 +27,23 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports = function () { } +>module.exports = function () { } : () => void +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void +>function () { } : () => void + +/** @param {number} a */ +module.exports.f = function (a) { } +>module.exports.f = function (a) { } : (a: any) => void +>module.exports.f : any +>module.exports : () => void +>module : { "export=": () => void; } +>exports : () => void +>f : any +>function (a) { } : (a: any) => void +>a : any + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt new file mode 100644 index 0000000000..7d5e2c2c91 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.errors.txt @@ -0,0 +1,25 @@ +a.js(4,6): error TS2339: Property 'f' does not exist on type '1'. +mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(3,16): error TS2339: Property 'f' does not exist on type '1'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.toFixed(12) + mod1.f() // error, 'f' is not a property on 'number' + ~ +!!! error TS2339: Property 'f' does not exist on type '1'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (2 errors) ==== + /// + module.exports = 1 + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.f = function () { } + ~ +!!! error TS2339: Property 'f' does not exist on type '1'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols index ba7038b6c4..ab4d96a505 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols @@ -5,9 +5,12 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.toFixed(12) +>mod1.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.f() // error, 'f' is not a property on 'number' >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -21,3 +24,15 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports = 1 +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + +module.exports.f = function () { } +>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 0, 0)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff index 97f96d0b7f..3f7dac72aa 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.symbols.diff @@ -1,32 +1,32 @@ --- old.moduleExportWithExportPropertyAssignment2.symbols +++ new.moduleExportWithExportPropertyAssignment2.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.toFixed(12) ->mod1.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.f() // error, 'f' is not a property on 'number' >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) -@@= skipped -18, +15 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports = 1 +@@= skipped -19, +19 lines =@@ + === mod1.js === + /// + module.exports = 1 ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 0, 0)) -->exports : Symbol(export=, Decl(mod1.js, 0, 0)) -- --module.exports.f = function () { } ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod1.js, 0, 0)) + + module.exports.f = function () { } ->module.exports : Symbol(f, Decl(mod1.js, 1, 18)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->f : Symbol(f, Decl(mod1.js, 1, 18)) ++>module.exports : Symbol(export=, Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 0, 0)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types index 9ad71ecd6b..8c1b21c209 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment2.types @@ -3,22 +3,22 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : 1 +>require('./mod1') : 1 >require : (name: string) => any >'./mod1' : "./mod1" mod1.toFixed(12) ->mod1.toFixed(12) : any ->mod1.toFixed : any ->mod1 : any ->toFixed : any +>mod1.toFixed(12) : string +>mod1.toFixed : (fractionDigits?: number) => string +>mod1 : 1 +>toFixed : (fractionDigits?: number) => string >12 : 12 mod1.f() // error, 'f' is not a property on 'number' >mod1.f() : any >mod1.f : any ->mod1 : any +>mod1 : 1 >f : any === requires.d.ts === @@ -30,3 +30,21 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports = 1 +>module.exports = 1 : 1 +>module.exports : 1 +>module : { "export=": 1; } +>exports : 1 +>1 : 1 + +module.exports.f = function () { } +>module.exports.f = function () { } : () => void +>module.exports.f : any +>module.exports : 1 +>module : { "export=": 1; } +>exports : 1 +>f : any +>function () { } : () => void + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt new file mode 100644 index 0000000000..0048e20c35 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.errors.txt @@ -0,0 +1,43 @@ +a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. +mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(8,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(9,16): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' + mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' + mod1.justProperty.length + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (4 errors) ==== + /// + module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports = { + ~~~~~~~~~~~~~~~~~~ + justExport: 1, + ~~~~~~~~~~~~~~~~~~ + bothBefore: 2, + ~~~~~~~~~~~~~~~~~~ + bothAfter: 3, + ~~~~~~~~~~~~~~~~~ + } + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols index 3ec55b9f3d..98651fb010 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols @@ -5,15 +5,28 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() +>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' +>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' +>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -27,3 +40,38 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) + +module.exports = { +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) + + justExport: 1, +>justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) + + bothBefore: 2, +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) + + bothAfter: 3, +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) + +module.exports.justProperty = 'string' +>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 1, 36)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff index df2b309725..197654e3e3 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.symbols.diff @@ -1,27 +1,34 @@ --- old.moduleExportWithExportPropertyAssignment3.symbols +++ new.moduleExportWithExportPropertyAssignment3.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() ->mod1.justExport.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) -->mod1.justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) ++>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) + >mod1.justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) -->justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) + >justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18), Decl(mod1.js, 0, 0)) ++>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18), Decl(mod1.js, 0, 0)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18), Decl(mod1.js, 6, 1)) ++>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18), Decl(mod1.js, 6, 1)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length ->mod1.justProperty.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) @@ -32,44 +39,50 @@ === requires.d.ts === declare var module: { exports: any }; -@@= skipped -34, +21 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' +@@= skipped -35, +35 lines =@@ + === mod1.js === + /// + module.exports.bothBefore = 'string' ->module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18), Decl(mod1.js, 0, 0)) ->module.exports : Symbol(bothBefore, Decl(mod1.js, 0, 0)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 0, 0)) -- --module.exports = { ++>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) + + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 1, 36)) -->exports : Symbol(export=, Decl(mod1.js, 1, 36)) -- -- justExport: 1, -->justExport : Symbol(justExport, Decl(mod1.js, 2, 18)) -- -- bothBefore: 2, -->bothBefore : Symbol(bothBefore, Decl(mod1.js, 3, 18)) -- -- bothAfter: 3, -->bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) --} --module.exports.bothAfter = 'string' ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod1.js, 1, 36)) + + justExport: 1, +@@= skipped -21, +21 lines =@@ + >bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) + } + module.exports.bothAfter = 'string' ->module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18), Decl(mod1.js, 6, 1)) ->module.exports : Symbol(bothAfter, Decl(mod1.js, 6, 1)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 6, 1)) -- --module.exports.justProperty = 'string' ++>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 4, 18)) + + module.exports.justProperty = 'string' ->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 7, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->justProperty : Symbol(justProperty, Decl(mod1.js, 7, 35)) ++>module.exports : Symbol(export=, Decl(mod1.js, 1, 36)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 1, 36)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types index 0e664abaaa..f3b476d806 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment3.types @@ -3,39 +3,39 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>require('./mod1') : { justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" mod1.justExport.toFixed() ->mod1.justExport.toFixed() : any ->mod1.justExport.toFixed : any ->mod1.justExport : any ->mod1 : any ->justExport : any ->toFixed : any +>mod1.justExport.toFixed() : string +>mod1.justExport.toFixed : (fractionDigits?: number) => string +>mod1.justExport : number +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>justExport : number +>toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothBefore.toFixed() : any ->mod1.bothBefore.toFixed : any ->mod1.bothBefore : any ->mod1 : any ->bothBefore : any ->toFixed : any +>mod1.bothBefore.toFixed() : string +>mod1.bothBefore.toFixed : (fractionDigits?: number) => string +>mod1.bothBefore : number +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' ->mod1.bothAfter.toFixed() : any ->mod1.bothAfter.toFixed : any ->mod1.bothAfter : any ->mod1 : any ->bothAfter : any ->toFixed : any +>mod1.bothAfter.toFixed() : string +>mod1.bothAfter.toFixed : (fractionDigits?: number) => string +>mod1.bothAfter : number +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>toFixed : (fractionDigits?: number) => string mod1.justProperty.length >mod1.justProperty.length : any >mod1.justProperty : any ->mod1 : any +>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } >justProperty : any >length : any @@ -48,3 +48,51 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore = 'string' : "string" +>module.exports.bothBefore : number +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>'string' : "string" + +module.exports = { +>module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } + + justExport: 1, +>justExport : number +>1 : 1 + + bothBefore: 2, +>bothBefore : number +>2 : 2 + + bothAfter: 3, +>bothAfter : number +>3 : 3 +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter = 'string' : "string" +>module.exports.bothAfter : number +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>'string' : "string" + +module.exports.justProperty = 'string' +>module.exports.justProperty = 'string' : "string" +>module.exports.justProperty : any +>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } +>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>'string' : "string" + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt new file mode 100644 index 0000000000..040e68925d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.errors.txt @@ -0,0 +1,41 @@ +a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. +mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. +mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + + +==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error + mod1.bothAfter.toFixed() + mod1.justProperty.length + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + +==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; +==== mod1.js (4 errors) ==== + /// + module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + A.justExport = 4 + A.bothBefore = 2 + A.bothAfter = 3 + module.exports = A + ~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + function A() { + this.p = 1 + } + module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' + ~~~~~~~~~~~~ +!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols index 0c8025b781..b236c055da 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols @@ -5,15 +5,28 @@ var mod1 = require('./mod1') >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) >require : Symbol(require, Decl(requires.d.ts, 0, 37)) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() +>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error +>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() +>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) +>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) @@ -27,3 +40,50 @@ declare function require(name: string): any; >require : Symbol(require, Decl(requires.d.ts, 0, 37)) >name : Symbol(name, Decl(requires.d.ts, 1, 25)) +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + +A.justExport = 4 +>A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) +>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) + +A.bothBefore = 2 +>A.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) +>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + +A.bothAfter = 3 +>A.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + +module.exports = A +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>A : Symbol(A, Decl(mod1.js, 5, 18)) + +function A() { +>A : Symbol(A, Decl(mod1.js, 5, 18)) + + this.p = 1 +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) +>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + +module.exports.justProperty = 'string' +>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) +>module : Symbol(module.exports) +>exports : Symbol(A, Decl(mod1.js, 5, 18)) + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff index 6fd4e98816..1c0d1c740e 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.symbols.diff @@ -1,27 +1,36 @@ --- old.moduleExportWithExportPropertyAssignment4.symbols +++ new.moduleExportWithExportPropertyAssignment4.symbols -@@= skipped -4, +4 lines =@@ - var mod1 = require('./mod1') - >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.justExport.toFixed() ->mod1.justExport.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ->mod1.justExport : Symbol(mod1.justExport, Decl(mod1.js, 1, 36)) ++>mod1.justExport.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->justExport : Symbol(mod1.justExport, Decl(mod1.js, 1, 36)) ->toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) ++>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothBefore.toFixed() // error ->mod1.bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ++>mod1.bothBefore.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothBefore : Symbol(mod1.bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.bothAfter.toFixed() ->mod1.bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ++>mod1.bothAfter.toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) ++>mod1.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) >mod1 : Symbol(mod1, Decl(a.js, 1, 3)) ->bothAfter : Symbol(mod1.bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>toFixed : Symbol(toFixed, Decl(lib.es5.d.ts, --, --)) mod1.justProperty.length ->mod1.justProperty.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --)) @@ -32,59 +41,82 @@ === requires.d.ts === declare var module: { exports: any }; -@@= skipped -34, +21 lines =@@ - declare function require(name: string): any; - >require : Symbol(require, Decl(requires.d.ts, 0, 37)) - >name : Symbol(name, Decl(requires.d.ts, 1, 25)) -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' +@@= skipped -35, +35 lines =@@ + === mod1.js === + /// + module.exports.bothBefore = 'string' ->module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ->module.exports : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -- --A.justExport = 4 ++>module.exports.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + + A.justExport = 4 ->A.justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->justExport : Symbol(A.justExport, Decl(mod1.js, 1, 36)) -- --A.bothBefore = 2 ++>A.justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) ++>justExport : Symbol(justExport, Decl(mod1.js, 1, 36)) + + A.bothBefore = 2 ->A.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16), Decl(mod1.js, 0, 0)) -- --A.bothAfter = 3 ++>A.bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothBefore : Symbol(bothBefore, Decl(mod1.js, 2, 16)) + + A.bothAfter = 3 ->A.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -- --module.exports = A ++>A.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + + module.exports = A ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 4, 15)) ->exports : Symbol(export=, Decl(mod1.js, 4, 15)) ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) -- --function A() { ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>A : Symbol(A, Decl(mod1.js, 5, 18)) + + function A() { ->A : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) -- -- this.p = 1 ++>A : Symbol(A, Decl(mod1.js, 5, 18)) + + this.p = 1 ->this.p : Symbol(A.p, Decl(mod1.js, 6, 14)) ->this : Symbol(A, Decl(mod1.js, 5, 18), Decl(mod1.js, 1, 36), Decl(mod1.js, 2, 16), Decl(mod1.js, 3, 16)) ->p : Symbol(A.p, Decl(mod1.js, 6, 14)) --} --module.exports.bothAfter = 'string' + } + module.exports.bothAfter = 'string' ->module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ->module.exports : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16), Decl(mod1.js, 8, 1)) -- --module.exports.justProperty = 'string' ++>module.exports.bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>bothAfter : Symbol(bothAfter, Decl(mod1.js, 3, 16)) + + module.exports.justProperty = 'string' ->module.exports.justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module.exports : Symbol(justProperty, Decl(mod1.js, 9, 35)) ->module : Symbol(module, Decl(mod1.js, 0, 0)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->justProperty : Symbol(justProperty, Decl(mod1.js, 9, 35)) ++>module.exports : Symbol(A, Decl(mod1.js, 5, 18)) ++>module : Symbol(module.exports) ++>exports : Symbol(A, Decl(mod1.js, 5, 18)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types index 7dc08c6e6c..48e342babc 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportWithExportPropertyAssignment4.types @@ -3,39 +3,39 @@ === a.js === /// var mod1 = require('./mod1') ->mod1 : any ->require('./mod1') : any +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" mod1.justExport.toFixed() ->mod1.justExport.toFixed() : any ->mod1.justExport.toFixed : any ->mod1.justExport : any ->mod1 : any ->justExport : any ->toFixed : any +>mod1.justExport.toFixed() : string +>mod1.justExport.toFixed : (fractionDigits?: number) => string +>mod1.justExport : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justExport : number +>toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error ->mod1.bothBefore.toFixed() : any ->mod1.bothBefore.toFixed : any ->mod1.bothBefore : any ->mod1 : any ->bothBefore : any ->toFixed : any +>mod1.bothBefore.toFixed() : string +>mod1.bothBefore.toFixed : (fractionDigits?: number) => string +>mod1.bothBefore : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() ->mod1.bothAfter.toFixed() : any ->mod1.bothAfter.toFixed : any ->mod1.bothAfter : any ->mod1 : any ->bothAfter : any ->toFixed : any +>mod1.bothAfter.toFixed() : string +>mod1.bothAfter.toFixed : (fractionDigits?: number) => string +>mod1.bothAfter : number +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>toFixed : (fractionDigits?: number) => string mod1.justProperty.length >mod1.justProperty.length : any >mod1.justProperty : any ->mod1 : any +>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >justProperty : any >length : any @@ -48,3 +48,70 @@ declare function require(name: string): any; >require : (name: string) => any >name : string +=== mod1.js === +/// +module.exports.bothBefore = 'string' +>module.exports.bothBefore = 'string' : "string" +>module.exports.bothBefore : number +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>'string' : "string" + +A.justExport = 4 +>A.justExport = 4 : 4 +>A.justExport : number +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justExport : number +>4 : 4 + +A.bothBefore = 2 +>A.bothBefore = 2 : 2 +>A.bothBefore : number +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothBefore : number +>2 : 2 + +A.bothAfter = 3 +>A.bothAfter = 3 : 3 +>A.bothAfter : number +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>3 : 3 + +module.exports = A +>module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + +function A() { +>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} +module.exports.bothAfter = 'string' +>module.exports.bothAfter = 'string' : "string" +>module.exports.bothAfter : number +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>bothAfter : number +>'string' : "string" + +module.exports.justProperty = 'string' +>module.exports.justProperty = 'string' : "string" +>module.exports.justProperty : any +>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } +>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>'string' : "string" + diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt index 41ca304157..da9dd12010 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.errors.txt @@ -1,21 +1,24 @@ -mod2.js(1,22): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. +mod1.js(6,24): error TS2339: Property 'e' does not exist on type '{}'. +mod2.js(6,8): error TS2339: Property 'e' does not exist on type '{}'. ==== mod2.js (1 errors) ==== const mod1 = require("./mod1"); - ~~~~~~~~ -!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. mod1.a; mod1.b; mod1.c; mod1.d; mod1.d.e; + ~ +!!! error TS2339: Property 'e' does not exist on type '{}'. mod1.default; -==== mod1.js (0 errors) ==== +==== mod1.js (1 errors) ==== exports.a = { x: "x" }; exports["b"] = { x: "x" }; exports["default"] = { x: "x" }; module.exports["c"] = { x: "x" }; module["exports"]["d"] = {}; module["exports"]["d"].e = 0; + ~ +!!! error TS2339: Property 'e' does not exist on type '{}'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols index c397e855b0..491743d1ac 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols @@ -4,22 +4,69 @@ const mod1 = require("./mod1"); >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) >require : Symbol(require) +>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.a; +>mod1.a : Symbol(a, Decl(mod1.js, 0, 0)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>a : Symbol(a, Decl(mod1.js, 0, 0)) mod1.b; +>mod1.b : Symbol("b", Decl(mod1.js, 0, 23)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>b : Symbol("b", Decl(mod1.js, 0, 23)) mod1.c; +>mod1.c : Symbol("c", Decl(mod1.js, 2, 32)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>c : Symbol("c", Decl(mod1.js, 2, 32)) mod1.d; +>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.d.e; +>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.default; +>mod1.default : Symbol("default", Decl(mod1.js, 1, 26)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) +>default : Symbol("default", Decl(mod1.js, 1, 26)) + +=== mod1.js === +exports.a = { x: "x" }; +>exports.a : Symbol(a, Decl(mod1.js, 0, 0)) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>a : Symbol(a, Decl(mod1.js, 0, 0)) +>x : Symbol(x, Decl(mod1.js, 0, 13)) + +exports["b"] = { x: "x" }; +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"b" : Symbol("b", Decl(mod1.js, 0, 23)) +>x : Symbol(x, Decl(mod1.js, 1, 16)) + +exports["default"] = { x: "x" }; +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"default" : Symbol("default", Decl(mod1.js, 1, 26)) +>x : Symbol(x, Decl(mod1.js, 2, 22)) + +module.exports["c"] = { x: "x" }; +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"c" : Symbol("c", Decl(mod1.js, 2, 32)) +>x : Symbol(x, Decl(mod1.js, 3, 23)) + +module["exports"]["d"] = {}; +>module : Symbol(module.exports) +>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"d" : Symbol("d", Decl(mod1.js, 3, 33)) + +module["exports"]["d"].e = 0; +>module : Symbol(module.exports) +>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) +>"d" : Symbol("d", Decl(mod1.js, 3, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff index ff51af1291..914178f445 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.symbols.diff @@ -5,71 +5,87 @@ >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) >require : Symbol(require) ->"./mod1" : Symbol(mod1, Decl(mod1.js, 0, 0)) ++>"./mod1" : Symbol("mod1", Decl(mod1.js, 0, 0)) mod1.a; ->mod1.a : Symbol(mod1.a, Decl(mod1.js, 0, 0)) ++>mod1.a : Symbol(a, Decl(mod1.js, 0, 0)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->a : Symbol(mod1.a, Decl(mod1.js, 0, 0)) ++>a : Symbol(a, Decl(mod1.js, 0, 0)) mod1.b; ->mod1.b : Symbol(mod1["b"], Decl(mod1.js, 0, 23)) ++>mod1.b : Symbol("b", Decl(mod1.js, 0, 23)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->b : Symbol(mod1["b"], Decl(mod1.js, 0, 23)) ++>b : Symbol("b", Decl(mod1.js, 0, 23)) mod1.c; ->mod1.c : Symbol(mod1["c"], Decl(mod1.js, 2, 32)) ++>mod1.c : Symbol("c", Decl(mod1.js, 2, 32)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->c : Symbol(mod1["c"], Decl(mod1.js, 2, 32)) ++>c : Symbol("c", Decl(mod1.js, 2, 32)) mod1.d; ->mod1.d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ++>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ++>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.d.e; ->mod1.d.e : Symbol(mod1["d"].e, Decl(mod1.js, 4, 28)) ->mod1.d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ++>mod1.d : Symbol("d", Decl(mod1.js, 3, 33)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->d : Symbol(mod1["d"], Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ->e : Symbol(mod1["d"].e, Decl(mod1.js, 4, 28)) ++>d : Symbol("d", Decl(mod1.js, 3, 33)) mod1.default; ->mod1.default : Symbol(mod1.default, Decl(mod1.js, 1, 26)) ++>mod1.default : Symbol("default", Decl(mod1.js, 1, 26)) >mod1 : Symbol(mod1, Decl(mod2.js, 0, 5)) ->default : Symbol(mod1.default, Decl(mod1.js, 1, 26)) -- --=== mod1.js === --exports.a = { x: "x" }; -->exports.a : Symbol(a, Decl(mod1.js, 0, 0)) ++>default : Symbol("default", Decl(mod1.js, 1, 26)) + + === mod1.js === + exports.a = { x: "x" }; + >exports.a : Symbol(a, Decl(mod1.js, 0, 0)) ->exports : Symbol(a, Decl(mod1.js, 0, 0)) -->a : Symbol(a, Decl(mod1.js, 0, 0)) -->x : Symbol(x, Decl(mod1.js, 0, 13)) -- --exports["b"] = { x: "x" }; -->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->"b" : Symbol("b", Decl(mod1.js, 0, 23)) -->x : Symbol(x, Decl(mod1.js, 1, 16)) -- --exports["default"] = { x: "x" }; -->exports : Symbol("mod1", Decl(mod1.js, 0, 0)) -->"default" : Symbol("default", Decl(mod1.js, 1, 26)) -->x : Symbol(x, Decl(mod1.js, 2, 22)) -- --module.exports["c"] = { x: "x" }; ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + >a : Symbol(a, Decl(mod1.js, 0, 0)) + >x : Symbol(x, Decl(mod1.js, 0, 13)) + +@@= skipped -52, +50 lines =@@ + >x : Symbol(x, Decl(mod1.js, 2, 22)) + + module.exports["c"] = { x: "x" }; ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(module, Decl(mod1.js, 2, 32)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->"c" : Symbol("c", Decl(mod1.js, 2, 32)) -->x : Symbol(x, Decl(mod1.js, 3, 23)) -- --module["exports"]["d"] = {}; ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + >"c" : Symbol("c", Decl(mod1.js, 2, 32)) + >x : Symbol(x, Decl(mod1.js, 3, 23)) + + module["exports"]["d"] = {}; ->module : Symbol(module, Decl(mod1.js, 2, 32)) ->"exports" : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->"d" : Symbol("d", Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) -- --module["exports"]["d"].e = 0; ++>module : Symbol(module.exports) ++>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>"d" : Symbol("d", Decl(mod1.js, 3, 33)) + + module["exports"]["d"].e = 0; ->module["exports"]["d"].e : Symbol("d".e, Decl(mod1.js, 4, 28)) ->module : Symbol(module, Decl(mod1.js, 2, 32)) ->"exports" : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->"d" : Symbol("d", Decl(mod1.js, 3, 33), Decl(mod1.js, 5, 18)) ->e : Symbol("d".e, Decl(mod1.js, 4, 28)) ++>module : Symbol(module.exports) ++>"exports" : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>"d" : Symbol("d", Decl(mod1.js, 3, 33)) diff --git a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types index 0ab897d93a..c84643db7c 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types +++ b/testdata/baselines/reference/submodule/conformance/moduleExportsElementAccessAssignment.types @@ -2,40 +2,99 @@ === mod2.js === const mod1 = require("./mod1"); ->mod1 : any ->require("./mod1") : any +>mod1 : typeof mod1 +>require("./mod1") : typeof mod1 >require : any >"./mod1" : "./mod1" mod1.a; ->mod1.a : any ->mod1 : any ->a : any +>mod1.a : { x: string; } +>mod1 : typeof mod1 +>a : { x: string; } mod1.b; ->mod1.b : any ->mod1 : any ->b : any +>mod1.b : { x: string; } +>mod1 : typeof mod1 +>b : { x: string; } mod1.c; ->mod1.c : any ->mod1 : any ->c : any +>mod1.c : { x: string; } +>mod1 : typeof mod1 +>c : { x: string; } mod1.d; ->mod1.d : any ->mod1 : any ->d : any +>mod1.d : {} +>mod1 : typeof mod1 +>d : {} mod1.d.e; >mod1.d.e : any ->mod1.d : any ->mod1 : any ->d : any +>mod1.d : {} +>mod1 : typeof mod1 +>d : {} >e : any mod1.default; ->mod1.default : any ->mod1 : any ->default : any +>mod1.default : { x: string; } +>mod1 : typeof mod1 +>default : { x: string; } + +=== mod1.js === +exports.a = { x: "x" }; +>exports.a = { x: "x" } : { x: string; } +>exports.a : { x: string; } +>exports : typeof import("./mod1") +>a : { x: string; } +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +exports["b"] = { x: "x" }; +>exports["b"] = { x: "x" } : { x: string; } +>exports["b"] : { x: string; } +>exports : typeof import("./mod1") +>"b" : "b" +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +exports["default"] = { x: "x" }; +>exports["default"] = { x: "x" } : { x: string; } +>exports["default"] : { x: string; } +>exports : typeof import("./mod1") +>"default" : "default" +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +module.exports["c"] = { x: "x" }; +>module.exports["c"] = { x: "x" } : { x: string; } +>module.exports["c"] : { x: string; } +>module.exports : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>exports : typeof import("./mod1") +>"c" : "c" +>{ x: "x" } : { x: string; } +>x : string +>"x" : "x" + +module["exports"]["d"] = {}; +>module["exports"]["d"] = {} : {} +>module["exports"]["d"] : {} +>module["exports"] : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>"exports" : "exports" +>"d" : "d" +>{} : {} + +module["exports"]["d"].e = 0; +>module["exports"]["d"].e = 0 : 0 +>module["exports"]["d"].e : any +>module["exports"]["d"] : {} +>module["exports"] : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>"exports" : "exports" +>"d" : "d" +>e : any +>0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols index 9f0bf2c87b..3a19abbb9b 100644 --- a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols +++ b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols @@ -3,13 +3,31 @@ === main.js === const { chalk: { grey } +>chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) >grey : Symbol(grey, Decl(main.js, 1, 12)) } = require('./mod1'); >require : Symbol(require) +>'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) grey >grey : Symbol(grey, Decl(main.js, 1, 12)) chalk +=== mod1.js === +const chalk = { +>chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) + + grey: {} +>grey : Symbol(grey, Decl(mod1.js, 0, 15)) + +}; +module.exports.chalk = chalk +>module.exports.chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) +>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) +>chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) +>chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) + diff --git a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff index 827c8303f6..63b4392e35 100644 --- a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.symbols.diff @@ -1,33 +1,14 @@ --- old.nestedDestructuringOfRequire.symbols +++ new.nestedDestructuringOfRequire.symbols -@@= skipped -2, +2 lines =@@ - === main.js === - const { - chalk: { grey } -->chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) - >grey : Symbol(grey, Decl(main.js, 1, 12)) - - } = require('./mod1'); - >require : Symbol(require) -->'./mod1' : Symbol("mod1", Decl(mod1.js, 0, 0)) - - grey - >grey : Symbol(grey, Decl(main.js, 1, 12)) - - chalk -- --=== mod1.js === --const chalk = { -->chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) -- -- grey: {} -->grey : Symbol(grey, Decl(mod1.js, 0, 15)) -- --}; --module.exports.chalk = chalk -->module.exports.chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) +@@= skipped -24, +24 lines =@@ + }; + module.exports.chalk = chalk + >module.exports.chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) ->module.exports : Symbol(chalk, Decl(mod1.js, 2, 2)) ->module : Symbol(module, Decl(mod1.js, 2, 2)) ->exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) -->chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) -->chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) ++>module.exports : Symbol("mod1", Decl(mod1.js, 0, 0)) ++>module : Symbol(module.exports) ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + >chalk : Symbol(chalk, Decl(mod1.js, 2, 2)) + >chalk : Symbol(chalk, Decl(mod1.js, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types index 400756f8b4..a5b0356940 100644 --- a/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types +++ b/testdata/baselines/reference/submodule/conformance/nestedDestructuringOfRequire.types @@ -4,16 +4,35 @@ const { chalk: { grey } >chalk : any ->grey : any +>grey : {} } = require('./mod1'); ->require('./mod1') : any +>require('./mod1') : typeof import("./mod1") >require : any >'./mod1' : "./mod1" grey ->grey : any +>grey : {} chalk >chalk : any +=== mod1.js === +const chalk = { +>chalk : { grey: {}; } +>{ grey: {}} : { grey: {}; } + + grey: {} +>grey : {} +>{} : {} + +}; +module.exports.chalk = chalk +>module.exports.chalk = chalk : { grey: {}; } +>module.exports.chalk : { grey: {}; } +>module.exports : typeof import("./mod1") +>module : { "\"mod1\"": typeof import("./mod1"); } +>exports : typeof import("./mod1") +>chalk : { grey: {}; } +>chalk : { grey: {}; } + diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols index 011dc2dbeb..27794910c7 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols @@ -4,8 +4,23 @@ var f = require('./first'); >f : Symbol(f, Decl(main.js, 0, 3)) >require : Symbol(require) +>'./first' : Symbol("first", Decl(first.js, 0, 0)) f(1, n => { }) >f : Symbol(f, Decl(main.js, 0, 3)) >n : Symbol(n, Decl(main.js, 1, 4)) +=== first.js === +/** @template T + * @param {T} x + * @param {(t: T) => void} k + */ +module.exports = function (x, k) { return k(x) } +>module.exports : Symbol(export=, Decl(first.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(first.js, 0, 0)) +>x : Symbol(x, Decl(first.js, 4, 27)) +>k : Symbol(k, Decl(first.js, 4, 29)) +>k : Symbol(k, Decl(first.js, 4, 29)) +>x : Symbol(x, Decl(first.js, 4, 27)) + diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff index 36c6092bbe..6752d4cbb7 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.symbols.diff @@ -1,25 +1,13 @@ --- old.paramTagTypeResolution.symbols +++ new.paramTagTypeResolution.symbols -@@= skipped -3, +3 lines =@@ - var f = require('./first'); - >f : Symbol(f, Decl(main.js, 0, 3)) - >require : Symbol(require) -->'./first' : Symbol("first", Decl(first.js, 0, 0)) - - f(1, n => { }) - >f : Symbol(f, Decl(main.js, 0, 3)) - >n : Symbol(n, Decl(main.js, 1, 4)) -- --=== first.js === --/** @template T -- * @param {T} x -- * @param {(t: T) => void} k -- */ --module.exports = function (x, k) { return k(x) } +@@= skipped -15, +15 lines =@@ + * @param {(t: T) => void} k + */ + module.exports = function (x, k) { return k(x) } ->module.exports : Symbol(module.exports, Decl(first.js, 0, 0)) ->module : Symbol(export=, Decl(first.js, 0, 0)) -->exports : Symbol(export=, Decl(first.js, 0, 0)) -->x : Symbol(x, Decl(first.js, 4, 27)) -->k : Symbol(k, Decl(first.js, 4, 29)) -->k : Symbol(k, Decl(first.js, 4, 29)) -->x : Symbol(x, Decl(first.js, 4, 27)) ++>module.exports : Symbol(export=, Decl(first.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(first.js, 0, 0)) + >x : Symbol(x, Decl(first.js, 4, 27)) + >k : Symbol(k, Decl(first.js, 4, 29)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types index b70d3476dd..9d2cd3f0d4 100644 --- a/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types +++ b/testdata/baselines/reference/submodule/conformance/paramTagTypeResolution.types @@ -2,15 +2,32 @@ === main.js === var f = require('./first'); ->f : any ->require('./first') : any +>f : (x: any, k: any) => any +>require('./first') : (x: any, k: any) => any >require : any >'./first' : "./first" f(1, n => { }) >f(1, n => { }) : any ->f : any +>f : (x: any, k: any) => any >1 : 1 >n => { } : (n: any) => void >n : any +=== first.js === +/** @template T + * @param {T} x + * @param {(t: T) => void} k + */ +module.exports = function (x, k) { return k(x) } +>module.exports = function (x, k) { return k(x) } : (x: any, k: any) => any +>module.exports : (x: any, k: any) => any +>module : { "export=": (x: any, k: any) => any; } +>exports : (x: any, k: any) => any +>function (x, k) { return k(x) } : (x: any, k: any) => any +>x : any +>k : any +>k(x) : any +>k : any +>x : any + diff --git a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols index 0e78faea9c..a4890727e6 100644 --- a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols +++ b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols @@ -3,7 +3,11 @@ === requireTwoPropertyAccesses.js === const value = require("./mod").x.y >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) +>require("./mod").x.y : Symbol(y, Decl(mod.js, 1, 8)) +>require("./mod").x : Symbol(x, Decl(mod.js, 0, 18)) >require : Symbol(require) +>x : Symbol(x, Decl(mod.js, 0, 18)) +>y : Symbol(y, Decl(mod.js, 1, 8)) console.log(value) >console.log : Symbol(log, Decl(lib.dom.d.ts, --, --)) @@ -11,3 +15,16 @@ console.log(value) >log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) +=== mod.js === +module.exports = { +>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod.js, 0, 0)) + + x: { +>x : Symbol(x, Decl(mod.js, 0, 18)) + + y: "value" +>y : Symbol(y, Decl(mod.js, 1, 8)) + } +} diff --git a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff index 1736bb1ba8..d53af0671e 100644 --- a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.symbols.diff @@ -1,15 +1,12 @@ --- old.requireTwoPropertyAccesses.symbols +++ new.requireTwoPropertyAccesses.symbols -@@= skipped -2, +2 lines =@@ - === requireTwoPropertyAccesses.js === - const value = require("./mod").x.y - >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) -->require("./mod").x.y : Symbol(y, Decl(mod.js, 1, 8)) -->require("./mod").x : Symbol(x, Decl(mod.js, 0, 18)) +@@= skipped -5, +5 lines =@@ + >require("./mod").x.y : Symbol(y, Decl(mod.js, 1, 8)) + >require("./mod").x : Symbol(x, Decl(mod.js, 0, 18)) >require : Symbol(require) ->"./mod" : Symbol("mod", Decl(mod.js, 0, 0)) -->x : Symbol(x, Decl(mod.js, 0, 18)) -->y : Symbol(y, Decl(mod.js, 1, 8)) + >x : Symbol(x, Decl(mod.js, 0, 18)) + >y : Symbol(y, Decl(mod.js, 1, 8)) console.log(value) ->console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) @@ -19,16 +16,12 @@ +>log : Symbol(log, Decl(lib.dom.d.ts, --, --)) >value : Symbol(value, Decl(requireTwoPropertyAccesses.js, 0, 5)) --=== mod.js === --module.exports = { + === mod.js === + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(export=, Decl(mod.js, 0, 0)) -->exports : Symbol(export=, Decl(mod.js, 0, 0)) -- -- x: { -->x : Symbol(x, Decl(mod.js, 0, 18)) -- -- y: "value" -->y : Symbol(y, Decl(mod.js, 1, 8)) -- } --} \ No newline at end of file ++>module.exports : Symbol(export=, Decl(mod.js, 0, 0)) ++>module : Symbol(module.exports) + >exports : Symbol(export=, Decl(mod.js, 0, 0)) + + x: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types index ab5891fac6..c3dcda46bd 100644 --- a/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types +++ b/testdata/baselines/reference/submodule/conformance/requireTwoPropertyAccesses.types @@ -2,19 +2,36 @@ === requireTwoPropertyAccesses.js === const value = require("./mod").x.y ->value : any ->require("./mod").x.y : any ->require("./mod").x : any ->require("./mod") : any +>value : string +>require("./mod").x.y : string +>require("./mod").x : { y: string; } +>require("./mod") : { x: { y: string; }; } >require : any >"./mod" : "./mod" ->x : any ->y : any +>x : { y: string; } +>y : string console.log(value) >console.log(value) : void >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->value : any +>value : string +=== mod.js === +module.exports = { +>module.exports = { x: { y: "value" }} : { x: { y: string; }; } +>module.exports : { x: { y: string; }; } +>module : { "export=": { x: { y: string; }; }; } +>exports : { x: { y: string; }; } +>{ x: { y: "value" }} : { x: { y: string; }; } + + x: { +>x : { y: string; } +>{ y: "value" } : { y: string; } + + y: "value" +>y : string +>"value" : "value" + } +} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt new file mode 100644 index 0000000000..c367fd4d66 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.errors.txt @@ -0,0 +1,35 @@ +use.js(3,8): error TS2554: Expected 1 arguments, but got 0. + + +==== use.js (1 errors) ==== + /// + var mini = require('./minimatch') + mini.M.defaults() + ~~~~~~~~ +!!! error TS2554: Expected 1 arguments, but got 0. +!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. + var m = new mini.M() + m.m() + mini.filter() + +==== types.d.ts (0 errors) ==== + declare var require: any; + declare var module: any; +==== minimatch.js (0 errors) ==== + /// + module.exports = minimatch + minimatch.M = M + minimatch.filter = filter + function filter() { + return minimatch() + } + function minimatch() { + } + M.defaults = function (def) { + return def + } + M.prototype.m = function () { + } + function M() { + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols index 3b2433b08b..5a1120117c 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols @@ -5,19 +5,28 @@ var mini = require('./minimatch') >mini : Symbol(mini, Decl(use.js, 1, 3)) >require : Symbol(require, Decl(types.d.ts, 0, 11)) +>'./minimatch' : Symbol("minimatch", Decl(minimatch.js, 0, 0)) mini.M.defaults() +>mini.M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) +>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) +>M : Symbol(M, Decl(minimatch.js, 1, 26)) +>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) var m = new mini.M() >m : Symbol(m, Decl(use.js, 3, 3)) +>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) +>M : Symbol(M, Decl(minimatch.js, 1, 26)) m.m() >m : Symbol(m, Decl(use.js, 3, 3)) mini.filter() +>mini.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) >mini : Symbol(mini, Decl(use.js, 1, 3)) +>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) === types.d.ts === declare var require: any; @@ -26,3 +35,50 @@ declare var require: any; declare var module: any; >module : Symbol(module, Decl(types.d.ts, 1, 11)) +=== minimatch.js === +/// +module.exports = minimatch +>module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>module : Symbol(module.exports) +>exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + +minimatch.M = M +>minimatch.M : Symbol(M, Decl(minimatch.js, 1, 26)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>M : Symbol(M, Decl(minimatch.js, 1, 26)) +>M : Symbol(M, Decl(minimatch.js, 13, 1)) + +minimatch.filter = filter +>minimatch.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) +>filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + +function filter() { +>filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + + return minimatch() +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +} +function minimatch() { +>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) +} +M.defaults = function (def) { +>M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) +>M : Symbol(M, Decl(minimatch.js, 13, 1)) +>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) +>def : Symbol(def, Decl(minimatch.js, 9, 23)) + + return def +>def : Symbol(def, Decl(minimatch.js, 9, 23)) +} +M.prototype.m = function () { +>M.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +>M : Symbol(M, Decl(minimatch.js, 13, 1)) +>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) +} +function M() { +>M : Symbol(M, Decl(minimatch.js, 13, 1)) +} + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff index c7ffcba567..0c2b43bbff 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.symbols.diff @@ -1,23 +1,26 @@ --- old.typeFromPropertyAssignment17.symbols +++ new.typeFromPropertyAssignment17.symbols -@@= skipped -4, +4 lines =@@ - var mini = require('./minimatch') - >mini : Symbol(mini, Decl(use.js, 1, 3)) - >require : Symbol(require, Decl(types.d.ts, 0, 11)) -->'./minimatch' : Symbol("minimatch", Decl(minimatch.js, 0, 0)) +@@= skipped -7, +7 lines =@@ + >'./minimatch' : Symbol("minimatch", Decl(minimatch.js, 0, 0)) mini.M.defaults() ->mini.M.defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) ->mini.M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ++>mini.M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) ++>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) ->M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ->defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) ++>M : Symbol(M, Decl(minimatch.js, 1, 26)) ++>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) var m = new mini.M() >m : Symbol(m, Decl(use.js, 3, 3)) ->mini.M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ++>mini.M : Symbol(M, Decl(minimatch.js, 1, 26)) >mini : Symbol(mini, Decl(use.js, 1, 3)) ->M : Symbol(mini.M, Decl(minimatch.js, 1, 26)) ++>M : Symbol(M, Decl(minimatch.js, 1, 26)) m.m() ->m.m : Symbol(M.m, Decl(minimatch.js, 11, 1)) @@ -26,60 +29,78 @@ mini.filter() ->mini.filter : Symbol(mini.filter, Decl(minimatch.js, 2, 15)) ++>mini.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) >mini : Symbol(mini, Decl(use.js, 1, 3)) ->filter : Symbol(mini.filter, Decl(minimatch.js, 2, 15)) ++>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) === types.d.ts === declare var require: any; -@@= skipped -31, +20 lines =@@ - - declare var module: any; - >module : Symbol(module, Decl(types.d.ts, 1, 11)) -- --=== minimatch.js === --/// --module.exports = minimatch +@@= skipped -32, +30 lines =@@ + === minimatch.js === + /// + module.exports = minimatch ->module.exports : Symbol(module.exports, Decl(minimatch.js, 0, 0)) ->module : Symbol(export=, Decl(minimatch.js, 0, 0)) ->exports : Symbol(export=, Decl(minimatch.js, 0, 0)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) -- --minimatch.M = M ++>module.exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>module : Symbol(module.exports) ++>exports : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + + minimatch.M = M ->minimatch.M : Symbol(minimatch.M, Decl(minimatch.js, 1, 26)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) ->M : Symbol(minimatch.M, Decl(minimatch.js, 1, 26)) ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) -- --minimatch.filter = filter ++>minimatch.M : Symbol(M, Decl(minimatch.js, 1, 26)) ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>M : Symbol(M, Decl(minimatch.js, 1, 26)) ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) + + minimatch.filter = filter ->minimatch.filter : Symbol(minimatch.filter, Decl(minimatch.js, 2, 15)) ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) ->filter : Symbol(minimatch.filter, Decl(minimatch.js, 2, 15)) -->filter : Symbol(filter, Decl(minimatch.js, 3, 25)) -- --function filter() { -->filter : Symbol(filter, Decl(minimatch.js, 3, 25)) -- -- return minimatch() ++>minimatch.filter : Symbol(filter, Decl(minimatch.js, 2, 15)) ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) ++>filter : Symbol(filter, Decl(minimatch.js, 2, 15)) + >filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + + function filter() { + >filter : Symbol(filter, Decl(minimatch.js, 3, 25)) + + return minimatch() ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) --} --function minimatch() { ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + } + function minimatch() { ->minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1), Decl(minimatch.js, 1, 26), Decl(minimatch.js, 2, 15)) --} --M.defaults = function (def) { ++>minimatch : Symbol(minimatch, Decl(minimatch.js, 6, 1)) + } + M.defaults = function (def) { ->M.defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) ->defaults : Symbol(M.defaults, Decl(minimatch.js, 8, 1)) -->def : Symbol(def, Decl(minimatch.js, 9, 23)) -- -- return def -->def : Symbol(def, Decl(minimatch.js, 9, 23)) --} --M.prototype.m = function () { ++>M.defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) ++>defaults : Symbol(defaults, Decl(minimatch.js, 8, 1)) + >def : Symbol(def, Decl(minimatch.js, 9, 23)) + + return def + >def : Symbol(def, Decl(minimatch.js, 9, 23)) + } + M.prototype.m = function () { ->M.prototype : Symbol(M.m, Decl(minimatch.js, 11, 1)) ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) ->prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) ->m : Symbol(M.m, Decl(minimatch.js, 11, 1)) --} --function M() { ++>M.prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) ++>prototype : Symbol(prototype, Decl(lib.es5.d.ts, --, --)) + } + function M() { ->M : Symbol(M, Decl(minimatch.js, 13, 1), Decl(minimatch.js, 8, 1)) --} ++>M : Symbol(M, Decl(minimatch.js, 13, 1)) + } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types index 50f2ba670c..20ccb10834 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment17.types @@ -3,25 +3,25 @@ === use.js === /// var mini = require('./minimatch') ->mini : any ->require('./minimatch') : any +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >require : any >'./minimatch' : "./minimatch" mini.M.defaults() >mini.M.defaults() : any ->mini.M.defaults : any ->mini.M : any ->mini : any ->M : any ->defaults : any +>mini.M.defaults : (def: any) => any +>mini.M : { (): void; defaults: (def: any) => any; } +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } +>defaults : (def: any) => any var m = new mini.M() >m : any >new mini.M() : any ->mini.M : any ->mini : any ->M : any +>mini.M : { (): void; defaults: (def: any) => any; } +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } m.m() >m.m() : any @@ -30,10 +30,10 @@ m.m() >m : any mini.filter() ->mini.filter() : any ->mini.filter : any ->mini : any ->filter : any +>mini.filter() : void +>mini.filter : () => void +>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>filter : () => void === types.d.ts === declare var require: any; @@ -42,3 +42,60 @@ declare var require: any; declare var module: any; >module : any +=== minimatch.js === +/// +module.exports = minimatch +>module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } +>exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + +minimatch.M = M +>minimatch.M = M : { (): void; defaults: (def: any) => any; } +>minimatch.M : { (): void; defaults: (def: any) => any; } +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>M : { (): void; defaults: (def: any) => any; } +>M : { (): void; defaults: (def: any) => any; } + +minimatch.filter = filter +>minimatch.filter = filter : () => void +>minimatch.filter : () => void +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +>filter : () => void +>filter : () => void + +function filter() { +>filter : () => void + + return minimatch() +>minimatch() : void +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +} +function minimatch() { +>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } +} +M.defaults = function (def) { +>M.defaults = function (def) { return def} : (def: any) => any +>M.defaults : (def: any) => any +>M : { (): void; defaults: (def: any) => any; } +>defaults : (def: any) => any +>function (def) { return def} : (def: any) => any +>def : any + + return def +>def : any +} +M.prototype.m = function () { +>M.prototype.m = function () {} : () => void +>M.prototype.m : any +>M.prototype : any +>M : { (): void; defaults: (def: any) => any; } +>prototype : any +>m : any +>function () {} : () => void +} +function M() { +>M : { (): void; defaults: (def: any) => any; } +} + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.errors.txt new file mode 100644 index 0000000000..ae7c3d1962 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.errors.txt @@ -0,0 +1,23 @@ +index.js(2,19): error TS2306: File 'semver.js' is not a module. +semver.js(2,1): error TS2304: Cannot find name 'exports'. + + +==== index.js (1 errors) ==== + /// + const C = require("./semver") + ~~~~~~~~~~ +!!! error TS2306: File 'semver.js' is not a module. + var two = C.f(1) + +==== types.d.ts (0 errors) ==== + declare var require: any; + declare var module: any; +==== semver.js (1 errors) ==== + /// + exports = module.exports = C + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. + C.f = n => n + 1 + function C() { + this.p = 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols index b642887626..9523fb3bf3 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols @@ -17,3 +17,21 @@ declare var require: any; declare var module: any; >module : Symbol(module, Decl(types.d.ts, 1, 11)) +=== semver.js === +/// +exports = module.exports = C +>module : Symbol(module, Decl(types.d.ts, 1, 11)) +>C : Symbol(C, Decl(semver.js, 2, 16)) + +C.f = n => n + 1 +>C.f : Symbol(f, Decl(semver.js, 1, 28)) +>C : Symbol(C, Decl(semver.js, 2, 16)) +>f : Symbol(f, Decl(semver.js, 1, 28)) +>n : Symbol(n, Decl(semver.js, 2, 5)) +>n : Symbol(n, Decl(semver.js, 2, 5)) + +function C() { +>C : Symbol(C, Decl(semver.js, 2, 16)) + + this.p = 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff index 85ecf52811..4336eaa349 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.symbols.diff @@ -14,31 +14,34 @@ === types.d.ts === declare var require: any; -@@= skipped -15, +12 lines =@@ - declare var module: any; - >module : Symbol(module, Decl(types.d.ts, 1, 11)) - --=== semver.js === --/// --exports = module.exports = C +@@= skipped -18, +15 lines =@@ + === semver.js === + /// + exports = module.exports = C ->exports : Symbol("semver", Decl(semver.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(semver.js, 0, 0)) ->module : Symbol(export=, Decl(semver.js, 1, 9)) ->exports : Symbol(export=, Decl(semver.js, 1, 9)) ->C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) -- --C.f = n => n + 1 ++>module : Symbol(module, Decl(types.d.ts, 1, 11)) ++>C : Symbol(C, Decl(semver.js, 2, 16)) + + C.f = n => n + 1 ->C.f : Symbol(C.f, Decl(semver.js, 1, 28)) ->C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) ->f : Symbol(C.f, Decl(semver.js, 1, 28)) -->n : Symbol(n, Decl(semver.js, 2, 5)) -->n : Symbol(n, Decl(semver.js, 2, 5)) -- --function C() { ++>C.f : Symbol(f, Decl(semver.js, 1, 28)) ++>C : Symbol(C, Decl(semver.js, 2, 16)) ++>f : Symbol(f, Decl(semver.js, 1, 28)) + >n : Symbol(n, Decl(semver.js, 2, 5)) + >n : Symbol(n, Decl(semver.js, 2, 5)) + + function C() { ->C : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) -- -- this.p = 1 ++>C : Symbol(C, Decl(semver.js, 2, 16)) + + this.p = 1 ->this.p : Symbol(C.p, Decl(semver.js, 3, 14)) ->this : Symbol(C, Decl(semver.js, 2, 16), Decl(semver.js, 1, 28)) ->p : Symbol(C.p, Decl(semver.js, 3, 14)) --} \ No newline at end of file + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types index 88801b3e16..4a10207ef1 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment19.types @@ -23,3 +23,35 @@ declare var require: any; declare var module: any; >module : any +=== semver.js === +/// +exports = module.exports = C +>exports = module.exports = C : { (): void; f: (n: any) => any; } +>exports : any +>module.exports = C : { (): void; f: (n: any) => any; } +>module.exports : any +>module : any +>exports : any +>C : { (): void; f: (n: any) => any; } + +C.f = n => n + 1 +>C.f = n => n + 1 : (n: any) => any +>C.f : (n: any) => any +>C : { (): void; f: (n: any) => any; } +>f : (n: any) => any +>n => n + 1 : (n: any) => any +>n : any +>n + 1 : any +>n : any +>1 : 1 + +function C() { +>C : { (): void; f: (n: any) => any; } + + this.p = 1 +>this.p = 1 : 1 +>this.p : any +>this : any +>p : any +>1 : 1 +} diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.errors.txt b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.errors.txt new file mode 100644 index 0000000000..a8a549a4f4 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.errors.txt @@ -0,0 +1,27 @@ +mod.js(1,14): error TS2304: Cannot find name 'exports'. +mod.js(1,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. +mod.js(3,10): error TS2339: Property 'existy' does not exist on type '{}'. +use.js(1,22): error TS2306: File 'mod.js' is not a module. + + +==== use.js (1 errors) ==== + const util = require('./mod') + ~~~~~~~ +!!! error TS2306: File 'mod.js' is not a module. + function n() { + util.existy // no error + } + util.existy // no error + +==== mod.js (3 errors) ==== + const util = exports = module.exports = {} + ~~~~~~~ +!!! error TS2304: Cannot find name 'exports'. + ~~~~~~ +!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + if (!!false) { + util.existy = function () { } + ~~~~~~ +!!! error TS2339: Property 'existy' does not exist on type '{}'. + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols index 866e4094e0..218408dd07 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols @@ -14,3 +14,12 @@ function n() { util.existy // no error >util : Symbol(util, Decl(use.js, 0, 5)) +=== mod.js === +const util = exports = module.exports = {} +>util : Symbol(util, Decl(mod.js, 0, 5)) + +if (!!false) { + util.existy = function () { } +>util : Symbol(util, Decl(mod.js, 0, 5)) +} + diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff index f1c5e684b5..c82a4373a0 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.symbols.diff @@ -18,18 +18,18 @@ ->util.existy : Symbol(util.existy, Decl(mod.js, 1, 14)) >util : Symbol(util, Decl(use.js, 0, 5)) ->existy : Symbol(util.existy, Decl(mod.js, 1, 14)) -- --=== mod.js === --const util = exports = module.exports = {} -->util : Symbol(util, Decl(mod.js, 0, 5)) + + === mod.js === + const util = exports = module.exports = {} + >util : Symbol(util, Decl(mod.js, 0, 5)) ->exports : Symbol("mod", Decl(mod.js, 0, 0)) ->module.exports : Symbol(module.exports, Decl(mod.js, 0, 0)) ->module : Symbol(module, Decl(mod.js, 0, 22)) ->exports : Symbol(module.exports, Decl(mod.js, 0, 0)) -- --if (!!false) { -- util.existy = function () { } + + if (!!false) { + util.existy = function () { } ->util.existy : Symbol(existy, Decl(mod.js, 1, 14)) -->util : Symbol(util, Decl(mod.js, 0, 5)) + >util : Symbol(util, Decl(mod.js, 0, 5)) ->existy : Symbol(existy, Decl(mod.js, 1, 14)) --} + } diff --git a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types index 291336ab14..6dbb6c85d9 100644 --- a/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types +++ b/testdata/baselines/reference/submodule/conformance/typeFromPropertyAssignment37.types @@ -20,3 +20,27 @@ util.existy // no error >util : any >existy : any +=== mod.js === +const util = exports = module.exports = {} +>util : {} +>exports = module.exports = {} : {} +>exports : any +>module.exports = {} : {} +>module.exports : any +>module : any +>exports : any +>{} : {} + +if (!!false) { +>!!false : boolean +>!false : true +>false : false + + util.existy = function () { } +>util.existy = function () { } : () => void +>util.existy : any +>util : {} +>existy : any +>function () { } : () => void +} + diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt new file mode 100644 index 0000000000..d48c75aeb1 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.errors.txt @@ -0,0 +1,73 @@ +mod1.js(3,23): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +mod1.js(4,7): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. +mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. +mod1.js(10,1): error TS2300: Duplicate identifier 'export='. +mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. +mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. +mod1.js(23,1): error TS2300: Duplicate identifier 'export='. +mod1.js(24,5): error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. +use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. +use.js(4,12): error TS2503: Cannot find namespace 'mod'. + + +==== use.js (2 errors) ==== + var mod = require('./mod1.js'); + /** @type {import("./mod1.js").Baz} */ + ~~~ +!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. + var b; + /** @type {mod.Baz} */ + ~~~ +!!! error TS2503: Cannot find namespace 'mod'. + var bb; + var bbb = new mod.Baz(); + +==== mod1.js (8 errors) ==== + // error + + /** @typedef {number} Foo */ + ~~~ +!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + class Foo { } // should error + ~~~ +!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + + /** @typedef {number} Bar */ + exports.Bar = class { } + ~~~ +!!! error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Baz */ + module.exports = { + ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ + Baz: class { } + ~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ + } + ~ +!!! error TS2300: Duplicate identifier 'export='. + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + + // ok + + /** @typedef {number} Qux */ + var Qux = 2; + + /** @typedef {number} Quid */ + exports.Quid = 2; + ~~~~ +!!! error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Quack */ + module.exports = { + ~~~~~~~~~~~~~~~~~~ + Quack: 2 + ~~~~~~~~~~~~ + ~~~~~ +!!! error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. + } + ~ +!!! error TS2300: Duplicate identifier 'export='. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols index 535d93955c..2104a285c8 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols @@ -4,6 +4,7 @@ var mod = require('./mod1.js'); >mod : Symbol(mod, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./mod1.js' : Symbol("mod1", Decl(mod1.js, 0, 0)) /** @type {import("./mod1.js").Baz} */ var b; @@ -15,5 +16,48 @@ var bb; var bbb = new mod.Baz(); >bbb : Symbol(bbb, Decl(use.js, 5, 3)) +>mod.Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) >mod : Symbol(mod, Decl(use.js, 0, 3)) +>Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) + +=== mod1.js === +// error + +/** @typedef {number} Foo */ +class Foo { } // should error +>Foo : Symbol(Foo, Decl(mod1.js, 2, 4), Decl(mod1.js, 0, 0)) + +/** @typedef {number} Bar */ +exports.Bar = class { } +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + +/** @typedef {number} Baz */ +module.exports = { +>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Baz: class { } +>Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) +} + +// ok + +/** @typedef {number} Qux */ +var Qux = 2; +>Qux : Symbol(Qux, Decl(mod1.js, 15, 4), Decl(mod1.js, 16, 3)) + +/** @typedef {number} Quid */ +exports.Quid = 2; +>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + +/** @typedef {number} Quack */ +module.exports = { +>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) +>module : Symbol(module.exports) +>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Quack: 2 +>Quack : Symbol(Quack, Decl(mod1.js, 22, 18)) +} diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff index 9c3a161b93..b01cc9dce5 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.symbols.diff @@ -1,62 +1,63 @@ --- old.typedefCrossModule2.symbols +++ new.typedefCrossModule2.symbols -@@= skipped -3, +3 lines =@@ - var mod = require('./mod1.js'); - >mod : Symbol(mod, Decl(use.js, 0, 3)) - >require : Symbol(require) -->'./mod1.js' : Symbol("mod1", Decl(mod1.js, 0, 0)) - - /** @type {import("./mod1.js").Baz} */ - var b; -@@= skipped -12, +11 lines =@@ +@@= skipped -15, +15 lines =@@ var bbb = new mod.Baz(); >bbb : Symbol(bbb, Decl(use.js, 5, 3)) ->mod.Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18)) ++>mod.Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) >mod : Symbol(mod, Decl(use.js, 0, 3)) ->Baz : Symbol(Baz, Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18), Decl(mod1.js, 8, 4), Decl(mod1.js, 9, 18)) -- --=== mod1.js === --// error -- --/** @typedef {number} Foo */ --class Foo { } // should error ++>Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) + + === mod1.js === + // error + + /** @typedef {number} Foo */ + class Foo { } // should error ->Foo : Symbol(Foo, Decl(mod1.js, 0, 0)) -- --/** @typedef {number} Bar */ --exports.Bar = class { } ++>Foo : Symbol(Foo, Decl(mod1.js, 2, 4), Decl(mod1.js, 0, 0)) + + /** @typedef {number} Bar */ + exports.Bar = class { } ->exports.Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ->exports : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) ->Bar : Symbol(Bar, Decl(mod1.js, 3, 13), Decl(mod1.js, 5, 4)) -- --/** @typedef {number} Baz */ --module.exports = { ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + + /** @typedef {number} Baz */ + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) ->exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) -- -- Baz: class { } -->Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) --} -- --// ok -- --/** @typedef {number} Qux */ --var Qux = 2; ++>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Baz: class { } + >Baz : Symbol(Baz, Decl(mod1.js, 9, 18)) +@@= skipped -31, +29 lines =@@ + + /** @typedef {number} Qux */ + var Qux = 2; ->Qux : Symbol(Qux, Decl(mod1.js, 16, 3), Decl(mod1.js, 15, 4)) -- --/** @typedef {number} Quid */ --exports.Quid = 2; ++>Qux : Symbol(Qux, Decl(mod1.js, 15, 4), Decl(mod1.js, 16, 3)) + + /** @typedef {number} Quid */ + exports.Quid = 2; ->exports.Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ->exports : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) ->Quid : Symbol(Quid, Decl(mod1.js, 16, 12), Decl(mod1.js, 18, 4)) -- --/** @typedef {number} Quack */ --module.exports = { ++>exports : Symbol("mod1", Decl(mod1.js, 0, 0)) + + /** @typedef {number} Quack */ + module.exports = { ->module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0)) ->module : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) ->exports : Symbol(export=, Decl(mod1.js, 6, 23), Decl(mod1.js, 19, 17)) -- -- Quack: 2 -->Quack : Symbol(Quack, Decl(mod1.js, 22, 18)) --} ++>module.exports : Symbol(export=, Decl(mod1.js, 6, 23)) ++>module : Symbol(module.exports) ++>exports : Symbol(export=, Decl(mod1.js, 6, 23)) + + Quack: 2 + >Quack : Symbol(Quack, Decl(mod1.js, 22, 18)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types index 41ab60f04e..e597356b31 100644 --- a/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types +++ b/testdata/baselines/reference/submodule/conformance/typedefCrossModule2.types @@ -2,8 +2,8 @@ === use.js === var mod = require('./mod1.js'); ->mod : any ->require('./mod1.js') : any +>mod : { Baz: typeof Baz; } +>require('./mod1.js') : { Baz: typeof Baz; } >require : any >'./mod1.js' : "./mod1.js" @@ -13,12 +13,68 @@ var b; /** @type {mod.Baz} */ var bb; ->bb : error +>bb : mod.Baz var bbb = new mod.Baz(); ->bbb : any ->new mod.Baz() : any ->mod.Baz : any ->mod : any ->Baz : any +>bbb : Baz +>new mod.Baz() : Baz +>mod.Baz : typeof Baz +>mod : { Baz: typeof Baz; } +>Baz : typeof Baz + +=== mod1.js === +// error + +/** @typedef {number} Foo */ +class Foo { } // should error +>Foo : Foo + +/** @typedef {number} Bar */ +exports.Bar = class { } +>exports.Bar = class { } : typeof Bar +>exports.Bar : any +>exports : typeof import("./mod1") +>Bar : any +>class { } : typeof Bar + +/** @typedef {number} Baz */ +module.exports = { +>module.exports = { Baz: class { }} : { Baz: typeof Baz; } +>module.exports : { Baz: typeof Baz; } +>module : { "export=": { Baz: typeof Baz; }; } +>exports : { Baz: typeof Baz; } +>{ Baz: class { }} : { Baz: typeof Baz; } + + Baz: class { } +>Baz : typeof Baz +>class { } : typeof Baz +} + +// ok + +/** @typedef {number} Qux */ +var Qux = 2; +>Qux : number +>2 : 2 + +/** @typedef {number} Quid */ +exports.Quid = 2; +>exports.Quid = 2 : 2 +>exports.Quid : any +>exports : typeof import("./mod1") +>Quid : any +>2 : 2 + +/** @typedef {number} Quack */ +module.exports = { +>module.exports = { Quack: 2} : { Quack: number; } +>module.exports : { Baz: typeof Baz; } +>module : { "export=": { Baz: typeof Baz; }; } +>exports : { Baz: typeof Baz; } +>{ Quack: 2} : { Quack: number; } + + Quack: 2 +>Quack : number +>2 : 2 +} diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols index 5ea4acb1be..6493017cb5 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols @@ -5,5 +5,14 @@ import foo from "foo"; >foo : Symbol(foo, Decl(a.ts, 0, 6)) foo.bar(); +>foo.bar : Symbol(bar, Decl(index.js, 0, 19)) >foo : Symbol(foo, Decl(a.ts, 0, 6)) +>bar : Symbol(bar, Decl(index.js, 0, 19)) + +=== /node_modules/foo/index.js === +exports.default = { bar() { return 0; } } +>exports.default : Symbol(default, Decl(index.js, 0, 0)) +>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) +>default : Symbol(default, Decl(index.js, 0, 0)) +>bar : Symbol(bar, Decl(index.js, 0, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff index 287bfadbab..b8241f1ff0 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.symbols.diff @@ -1,16 +1,10 @@ --- old.untypedModuleImport_allowJs.symbols +++ new.untypedModuleImport_allowJs.symbols -@@= skipped -4, +4 lines =@@ - >foo : Symbol(foo, Decl(a.ts, 0, 6)) - - foo.bar(); -->foo.bar : Symbol(bar, Decl(index.js, 0, 19)) - >foo : Symbol(foo, Decl(a.ts, 0, 6)) -->bar : Symbol(bar, Decl(index.js, 0, 19)) -- --=== /node_modules/foo/index.js === --exports.default = { bar() { return 0; } } -->exports.default : Symbol(default, Decl(index.js, 0, 0)) +@@= skipped -11, +11 lines =@@ + === /node_modules/foo/index.js === + exports.default = { bar() { return 0; } } + >exports.default : Symbol(default, Decl(index.js, 0, 0)) ->exports : Symbol(default, Decl(index.js, 0, 0)) -->default : Symbol(default, Decl(index.js, 0, 0)) -->bar : Symbol(bar, Decl(index.js, 0, 19)) ++>exports : Symbol("/node_modules/foo/index", Decl(index.js, 0, 0)) + >default : Symbol(default, Decl(index.js, 0, 0)) + >bar : Symbol(bar, Decl(index.js, 0, 19)) diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types index 097d7fa7f1..0dbb57e504 100644 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types +++ b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types @@ -2,11 +2,21 @@ === /a.ts === import foo from "foo"; ->foo : any +>foo : { bar(): number; } foo.bar(); ->foo.bar() : any ->foo.bar : any ->foo : any ->bar : any +>foo.bar() : number +>foo.bar : () => number +>foo : { bar(): number; } +>bar : () => number + +=== /node_modules/foo/index.js === +exports.default = { bar() { return 0; } } +>exports.default = { bar() { return 0; } } : { bar(): number; } +>exports.default : { bar(): number; } +>exports : typeof import("foo") +>default : { bar(): number; } +>{ bar() { return 0; } } : { bar(): number; } +>bar : () => number +>0 : 0 diff --git a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types.diff b/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types.diff deleted file mode 100644 index 2cc89eac90..0000000000 --- a/testdata/baselines/reference/submodule/conformance/untypedModuleImport_allowJs.types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.untypedModuleImport_allowJs.types -+++ new.untypedModuleImport_allowJs.types -@@= skipped -1, +1 lines =@@ - - === /a.ts === - import foo from "foo"; -->foo : { bar(): number; } -+>foo : any - - foo.bar(); -->foo.bar() : number -->foo.bar : () => number -->foo : { bar(): number; } -->bar : () => number -- --=== /node_modules/foo/index.js === --exports.default = { bar() { return 0; } } -->exports.default = { bar() { return 0; } } : { bar(): number; } -->exports.default : { bar(): number; } -->exports : typeof import("/node_modules/foo/index") -->default : { bar(): number; } -->{ bar() { return 0; } } : { bar(): number; } -->bar : () => number -->0 : 0 -+>foo.bar() : any -+>foo.bar : any -+>foo : any -+>bar : any diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt deleted file mode 100644 index b70c00d167..0000000000 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -use.js(1,18): error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. - - -==== use.js (1 errors) ==== - var ex = require('./ex') - ~~~~~~ -!!! error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. - - // values work - var crunch = new ex.Crunch(1); - crunch.n - - - // types work - /** - * @param {ex.Crunch} wrap - */ - function f(wrap) { - wrap.n - } - -==== ex.js (0 errors) ==== - export class Crunch { - /** @param {number} n */ - constructor(n) { - this.n = n - } - m() { - return this.n - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols index 78f0125a3f..5bd7b88632 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols @@ -4,14 +4,19 @@ var ex = require('./ex') >ex : Symbol(ex, Decl(use.js, 0, 3)) >require : Symbol(require) +>'./ex' : Symbol("ex", Decl(ex.js, 0, 0)) // values work var crunch = new ex.Crunch(1); >crunch : Symbol(crunch, Decl(use.js, 3, 3)) +>ex.Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) >ex : Symbol(ex, Decl(use.js, 0, 3)) +>Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) crunch.n +>crunch.n : Symbol(n, Decl(ex.js, 2, 20)) >crunch : Symbol(crunch, Decl(use.js, 3, 3)) +>n : Symbol(n, Decl(ex.js, 2, 20)) // types work @@ -23,6 +28,32 @@ function f(wrap) { >wrap : Symbol(wrap, Decl(use.js, 11, 11)) wrap.n +>wrap.n : Symbol(n, Decl(ex.js, 2, 20)) >wrap : Symbol(wrap, Decl(use.js, 11, 11)) +>n : Symbol(n, Decl(ex.js, 2, 20)) +} + +=== ex.js === +export class Crunch { +>Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) + + /** @param {number} n */ + constructor(n) { +>n : Symbol(n, Decl(ex.js, 2, 16)) + + this.n = n +>this.n : Symbol(n, Decl(ex.js, 2, 20)) +>this : Symbol(Crunch, Decl(ex.js, 0, 0)) +>n : Symbol(n, Decl(ex.js, 2, 20)) +>n : Symbol(n, Decl(ex.js, 2, 16)) + } + m() { +>m : Symbol(m, Decl(ex.js, 4, 5)) + + return this.n +>this.n : Symbol(n, Decl(ex.js, 2, 20)) +>this : Symbol(Crunch, Decl(ex.js, 0, 0)) +>n : Symbol(n, Decl(ex.js, 2, 20)) + } } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff index f50187c503..1a5c6f6d64 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.symbols.diff @@ -5,50 +5,58 @@ >ex : Symbol(ex, Decl(use.js, 0, 3)) >require : Symbol(require) ->'./ex' : Symbol(ex, Decl(ex.js, 0, 0)) ++>'./ex' : Symbol("ex", Decl(ex.js, 0, 0)) // values work var crunch = new ex.Crunch(1); >crunch : Symbol(crunch, Decl(use.js, 3, 3)) ->ex.Crunch : Symbol(ex.Crunch, Decl(ex.js, 0, 0)) ++>ex.Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) >ex : Symbol(ex, Decl(use.js, 0, 3)) ->Crunch : Symbol(ex.Crunch, Decl(ex.js, 0, 0)) ++>Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) crunch.n ->crunch.n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) ++>crunch.n : Symbol(n, Decl(ex.js, 2, 20)) >crunch : Symbol(crunch, Decl(use.js, 3, 3)) ->n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) ++>n : Symbol(n, Decl(ex.js, 2, 20)) // types work -@@= skipped -24, +19 lines =@@ +@@= skipped -24, +24 lines =@@ >wrap : Symbol(wrap, Decl(use.js, 11, 11)) wrap.n ->wrap.n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) ++>wrap.n : Symbol(n, Decl(ex.js, 2, 20)) >wrap : Symbol(wrap, Decl(use.js, 11, 11)) ->n : Symbol(ex.Crunch.n, Decl(ex.js, 2, 20)) --} -- --=== ex.js === --export class Crunch { -->Crunch : Symbol(Crunch, Decl(ex.js, 0, 0)) -- -- /** @param {number} n */ -- constructor(n) { -->n : Symbol(n, Decl(ex.js, 2, 16)) -- -- this.n = n ++>n : Symbol(n, Decl(ex.js, 2, 20)) + } + + === ex.js === +@@= skipped -14, +14 lines =@@ + >n : Symbol(n, Decl(ex.js, 2, 16)) + + this.n = n ->this.n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -->this : Symbol(Crunch, Decl(ex.js, 0, 0)) ++>this.n : Symbol(n, Decl(ex.js, 2, 20)) + >this : Symbol(Crunch, Decl(ex.js, 0, 0)) ->n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -->n : Symbol(n, Decl(ex.js, 2, 16)) -- } -- m() { ++>n : Symbol(n, Decl(ex.js, 2, 20)) + >n : Symbol(n, Decl(ex.js, 2, 16)) + } + m() { ->m : Symbol(Crunch.m, Decl(ex.js, 4, 5)) -- -- return this.n ++>m : Symbol(m, Decl(ex.js, 4, 5)) + + return this.n ->this.n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -->this : Symbol(Crunch, Decl(ex.js, 0, 0)) ++>this.n : Symbol(n, Decl(ex.js, 2, 20)) + >this : Symbol(Crunch, Decl(ex.js, 0, 0)) ->n : Symbol(Crunch.n, Decl(ex.js, 2, 20)) -- } ++>n : Symbol(n, Decl(ex.js, 2, 20)) + } } diff --git a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types index cc1971a387..7ce58f2f6a 100644 --- a/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types +++ b/testdata/baselines/reference/submodule/conformance/varRequireFromJavascript.types @@ -2,24 +2,24 @@ === use.js === var ex = require('./ex') ->ex : any ->require('./ex') : any +>ex : typeof ex +>require('./ex') : typeof ex >require : any >'./ex' : "./ex" // values work var crunch = new ex.Crunch(1); ->crunch : any ->new ex.Crunch(1) : any ->ex.Crunch : any ->ex : any ->Crunch : any +>crunch : ex.Crunch +>new ex.Crunch(1) : ex.Crunch +>ex.Crunch : typeof ex.Crunch +>ex : typeof ex +>Crunch : typeof ex.Crunch >1 : 1 crunch.n ->crunch.n : any ->crunch : any ->n : any +>crunch.n : number +>crunch : ex.Crunch +>n : number // types work @@ -31,8 +31,33 @@ function f(wrap) { >wrap : ex.Crunch wrap.n ->wrap.n : any +>wrap.n : number >wrap : ex.Crunch ->n : any +>n : number +} + +=== ex.js === +export class Crunch { +>Crunch : Crunch + + /** @param {number} n */ + constructor(n) { +>n : number + + this.n = n +>this.n = n : number +>this.n : number +>this : this +>n : number +>n : number + } + m() { +>m : () => number + + return this.n +>this.n : number +>this : this +>n : number + } } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff index 2345abc46d..684cecfc56 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/ensureNoCrashExportAssignmentDefineProperrtyPotentialMerge.types.diff @@ -6,8 +6,8 @@ const _item = require("./namespacer"); ->_item : typeof _item ->require("./namespacer") : typeof _item -+>_item : any -+>require("./namespacer") : any ++>_item : { NS: { bar: typeof Q; }; } ++>require("./namespacer") : { NS: { bar: typeof Q; }; } >require : any >"./namespacer" : "./namespacer" @@ -33,58 +33,79 @@ >"exports" : "exports" >{ value: "oh no" } : { value: string; } >value : string - >"oh no" : "oh no" -- --=== namespacey.js === --const A = {} +@@= skipped -25, +25 lines =@@ + + === namespacey.js === + const A = {} ->A : typeof A ->{} : {} -- --A.bar = class Q {} -->A.bar = class Q {} : typeof Q -->A.bar : typeof Q ++>A : { bar: typeof Q; } ++>{} : { bar: typeof Q; } + + A.bar = class Q {} + >A.bar = class Q {} : typeof Q + >A.bar : typeof Q ->A : typeof A -->bar : typeof Q -->class Q {} : typeof Q -->Q : typeof Q -- --module.exports = A; ++>A : { bar: typeof Q; } + >bar : typeof Q + >class Q {} : typeof Q + >Q : typeof Q + + module.exports = A; ->module.exports = A : typeof A ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->A : typeof A -- --=== namespacer.js === --const B = {} ++>module.exports = A : { bar: typeof Q; } ++>module.exports : { bar: typeof Q; } ++>module : { readonly A: { bar: typeof Q; }; } ++>exports : { bar: typeof Q; } ++>A : { bar: typeof Q; } + + === namespacer.js === + const B = {} ->B : typeof B ->{} : {} -- --B.NS = require("./namespacey"); ++>B : { NS: { bar: typeof Q; }; } ++>{} : { NS: { bar: typeof Q; }; } + + B.NS = require("./namespacey"); ->B.NS = require("./namespacey") : typeof A ->B.NS : string | typeof A ->B : typeof B ->NS : string | typeof A ->require("./namespacey") : typeof A -->require : any -->"./namespacey" : "./namespacey" -- --Object.defineProperty(B, "NS", { value: "why though", writable: true }); ++>B.NS = require("./namespacey") : { bar: typeof Q; } ++>B.NS : { bar: typeof Q; } ++>B : { NS: { bar: typeof Q; }; } ++>NS : { bar: typeof Q; } ++>require("./namespacey") : { bar: typeof Q; } + >require : any + >"./namespacey" : "./namespacey" + + Object.defineProperty(B, "NS", { value: "why though", writable: true }); ->Object.defineProperty(B, "NS", { value: "why though", writable: true }) : typeof B -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(B, "NS", { value: "why though", writable: true }) : { NS: { bar: typeof Q; }; } + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->B : typeof B -->"NS" : "NS" -->{ value: "why though", writable: true } : { value: string; writable: true; } -->value : string -->"why though" : "why though" -->writable : true -->true : true -- --module.exports = B; ++>B : { NS: { bar: typeof Q; }; } + >"NS" : "NS" + >{ value: "why though", writable: true } : { value: string; writable: true; } + >value : string +@@= skipped -46, +46 lines =@@ + >true : true + + module.exports = B; ->module.exports = B : typeof B ->module.exports : typeof B ->module : { exports: typeof B; } ->exports : typeof B ->B : typeof B ++>module.exports = B : { NS: { bar: typeof Q; }; } ++>module.exports : { NS: { bar: typeof Q; }; } ++>module : { readonly B: { NS: { bar: typeof Q; }; }; } ++>exports : { NS: { bar: typeof Q; }; } ++>B : { NS: { bar: typeof Q; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff new file mode 100644 index 0000000000..708fd18a67 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.errors.txt.diff @@ -0,0 +1,54 @@ +--- old.jsEnumTagOnObjectFrozen.errors.txt ++++ new.jsEnumTagOnObjectFrozen.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(10,12): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++index.js(17,16): error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++ ++ ++==== usage.js (0 errors) ==== ++ const { Thing, useThing, cbThing } = require("./index"); ++ ++ useThing(Thing.a); ++ ++ /** ++ * @typedef {Object} LogEntry ++ * @property {string} type ++ * @property {number} time ++ */ ++ ++ cbThing(type => { ++ /** @type {LogEntry} */ ++ const logEntry = { ++ time: Date.now(), ++ type, ++ }; ++ }); ++ ++==== index.js (2 errors) ==== ++ /** @enum {string} */ ++ const Thing = Object.freeze({ ++ a: "thing", ++ b: "chill" ++ }); ++ ++ exports.Thing = Thing; ++ ++ /** ++ * @param {Thing} x ++ ~~~~~ ++!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++ */ ++ function useThing(x) {} ++ ++ exports.useThing = useThing; ++ ++ /** ++ * @param {(x: Thing) => void} x ++ ~~~~~ ++!!! error TS2749: 'Thing' refers to a value, but is being used as a type here. Did you mean 'typeof Thing'? ++ */ ++ function cbThing(x) {} ++ ++ exports.cbThing = cbThing; ++ \ 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 5fdb418e13..8ba89ee226 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/jsEnumTagOnObjectFrozen.types.diff @@ -1,116 +1,81 @@ --- old.jsEnumTagOnObjectFrozen.types +++ new.jsEnumTagOnObjectFrozen.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const { Thing, useThing, cbThing } = require("./index"); -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->useThing : (x: Thing) => void -->cbThing : (x: (x: Thing) => void) => void +@@= skipped -4, +4 lines =@@ + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + >useThing : (x: Thing) => void + >cbThing : (x: (x: Thing) => void) => void ->require("./index") : typeof import("index") -+>Thing : any -+>useThing : any -+>cbThing : any -+>require("./index") : any ++>require("./index") : typeof import("./index") >require : any >"./index" : "./index" - useThing(Thing.a); -->useThing(Thing.a) : void -->useThing : (x: Thing) => void -->Thing.a : "thing" -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->a : "thing" -+>useThing(Thing.a) : any -+>useThing : any -+>Thing.a : any -+>Thing : any -+>a : any - - /** - * @typedef {Object} LogEntry -@@= skipped -21, +21 lines =@@ - */ - +@@= skipped -20, +20 lines =@@ cbThing(type => { -->cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : void -->cbThing : (x: (x: Thing) => void) => void + >cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : void + >cbThing : (x: (x: Thing) => void) => void ->type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: string) => void ->type : string -+>cbThing(type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };}) : any -+>cbThing : any -+>type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: any) => void -+>type : any ++>type => { /** @type {LogEntry} */ const logEntry = { time: Date.now(), type, };} : (type: Thing) => void ++>type : Thing /** @type {LogEntry} */ const logEntry = { >logEntry : LogEntry ->{ time: Date.now(), type, } : { time: number; type: string; } -+>{ time: Date.now(), type, } : { time: number; type: any; } ++>{ time: Date.now(), type, } : { time: number; type: Thing; } time: Date.now(), >time : number -@@= skipped -18, +18 lines =@@ +@@= skipped -16, +16 lines =@@ >now : () => number type, ->type : string -+>type : any ++>type : Thing }; }); -- --=== index.js === --/** @enum {string} */ --const Thing = Object.freeze({ -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ a: "thing"; b: "chill"; }> +@@= skipped -10, +10 lines =@@ + const Thing = Object.freeze({ + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + >Object.freeze({ a: "thing", b: "chill"}) : Readonly<{ a: "thing"; b: "chill"; }> ->Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } -->Object : ObjectConstructor ++>Object.freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } + >Object : ObjectConstructor ->freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } -->{ a: "thing", b: "chill"} : { a: "thing"; b: "chill"; } -- -- a: "thing", -->a : "thing" -->"thing" : "thing" -- -- b: "chill" -->b : "chill" -->"chill" : "chill" -- --}); -- --exports.Thing = Thing; -->exports.Thing = Thing : Readonly<{ a: "thing"; b: "chill"; }> -->exports.Thing : Readonly<{ a: "thing"; b: "chill"; }> ++>freeze : { (f: T): T; (o: T): Readonly; (o: T): Readonly; } + >{ a: "thing", b: "chill"} : { a: "thing"; b: "chill"; } + + a: "thing", +@@= skipped -18, +18 lines =@@ + exports.Thing = Thing; + >exports.Thing = Thing : Readonly<{ a: "thing"; b: "chill"; }> + >exports.Thing : Readonly<{ a: "thing"; b: "chill"; }> ->exports : typeof import("index") -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -->Thing : Readonly<{ a: "thing"; b: "chill"; }> -- --/** -- * @param {Thing} x -- */ --function useThing(x) {} -->useThing : (x: Thing) => void ++>exports : typeof import(".") + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + >Thing : Readonly<{ a: "thing"; b: "chill"; }> + +@@= skipped -9, +9 lines =@@ + */ + function useThing(x) {} + >useThing : (x: Thing) => void ->x : string -- --exports.useThing = useThing; -->exports.useThing = useThing : (x: Thing) => void -->exports.useThing : (x: Thing) => void ++>x : Thing + + exports.useThing = useThing; + >exports.useThing = useThing : (x: Thing) => void + >exports.useThing : (x: Thing) => void ->exports : typeof import("index") -->useThing : (x: Thing) => void -->useThing : (x: Thing) => void -- --/** -- * @param {(x: Thing) => void} x -- */ --function cbThing(x) {} -->cbThing : (x: (x: Thing) => void) => void -->x : (x: Thing) => void -- --exports.cbThing = cbThing; -->exports.cbThing = cbThing : (x: (x: Thing) => void) => void -->exports.cbThing : (x: (x: Thing) => void) => void ++>exports : typeof import(".") + >useThing : (x: Thing) => void + >useThing : (x: Thing) => void + +@@= skipped -19, +19 lines =@@ + exports.cbThing = cbThing; + >exports.cbThing = cbThing : (x: (x: Thing) => void) => void + >exports.cbThing : (x: (x: Thing) => void) => void ->exports : typeof import("index") -->cbThing : (x: (x: Thing) => void) => void -->cbThing : (x: (x: Thing) => void) => void ++>exports : typeof import(".") + >cbThing : (x: (x: Thing) => void) => void + >cbThing : (x: (x: Thing) => void) => void diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff index 114c264911..fe7011b1d5 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt.diff @@ -2,17 +2,13 @@ +++ new.moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.errors.txt @@= skipped -0, +0 lines =@@ - -+eslint.config.js(1,29): error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. -+eslint.config.js(2,26): error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. ++typescript-eslint.js(12,17): error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. ++typescript-eslint.js(14,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== eslint.config.js (2 errors) ==== ++==== eslint.config.js (0 errors) ==== + const eslintReact = require('./eslint-plugin-react.js'); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './eslint-plugin-react.js'. 'eslint-plugin-react.js' implicitly has an 'any' type. + const tseslint = require('./typescript-eslint.js'); -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './typescript-eslint.js'. 'typescript-eslint.js' implicitly has an 'any' type. + + tseslint.config(eslintReact) + @@ -34,7 +30,7 @@ + }, + }; + -+==== typescript-eslint.js (0 errors) ==== ++==== typescript-eslint.js (2 errors) ==== + /** + * @typedef {{ rules: Record }} Plugin + */ @@ -47,6 +43,10 @@ + * @type {(...configs: Config[]) => void} + */ + function config(...configs) { } ++ ~~~~~~~~~~ ++!!! error TS7019: Rest parameter 'configs' implicitly has an 'any[]' type. + + module.exports = { config }; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff index 471376b418..215c288fd9 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleExportsTypeNoExcessPropertyCheckFromContainedLiteral.types.diff @@ -6,96 +6,100 @@ const eslintReact = require('./eslint-plugin-react.js'); ->eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } -+>eslintReact : any -+>require('./eslint-plugin-react.js') : any ++>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>require('./eslint-plugin-react.js') : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } >require : any >'./eslint-plugin-react.js' : "./eslint-plugin-react.js" const tseslint = require('./typescript-eslint.js'); ->tseslint : typeof tseslint ->require('./typescript-eslint.js') : typeof tseslint -+>tseslint : any -+>require('./typescript-eslint.js') : any ++>tseslint : { config: (...configs: any[]) => void; } ++>require('./typescript-eslint.js') : { config: (...configs: any[]) => void; } >require : any >'./typescript-eslint.js' : "./typescript-eslint.js" tseslint.config(eslintReact) -->tseslint.config(eslintReact) : void + >tseslint.config(eslintReact) : void ->tseslint.config : (...configs: Config[]) => void ->tseslint : typeof tseslint ->config : (...configs: Config[]) => void ->eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } -- --=== eslint-plugin-react.js === --const deprecatedRules = { -->deprecatedRules : { "jsx-sort-default-props": boolean; } -->{ "jsx-sort-default-props": true} : { "jsx-sort-default-props": boolean; } -- -- "jsx-sort-default-props": true -->"jsx-sort-default-props" : boolean -->true : true --} -- --const allRules = { ++>tseslint.config : (...configs: any[]) => void ++>tseslint : { config: (...configs: any[]) => void; } ++>config : (...configs: any[]) => void ++>eslintReact : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + + === eslint-plugin-react.js === + const deprecatedRules = { +@@= skipped -29, +29 lines =@@ + } + + const allRules = { ->allRules : { 'no-unsafe': boolean; } ->{ 'no-unsafe': true} : { 'no-unsafe': boolean; } -- -- 'no-unsafe': true -->'no-unsafe' : boolean -->true : true --} -- --module.exports = { ++>allRules : { "no-unsafe": boolean; } ++>{ 'no-unsafe': true} : { "no-unsafe": boolean; } + + 'no-unsafe': true + >'no-unsafe' : boolean +@@= skipped -9, +9 lines =@@ + } + + module.exports = { ->module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->module : { exports: { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; }; } ->exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } ->{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; }; } -- -- plugins: { ++>module.exports = { plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>module.exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>module : { "export=": { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; }; } ++>exports : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } ++>{ plugins: { react: { deprecatedRules, rules: allRules, }, },} : { plugins: { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; }; } + + plugins: { ->plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; } ->{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; }; } -- -- react: { ++>plugins : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } ++>{ react: { deprecatedRules, rules: allRules, }, } : { react: { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; }; } + + react: { ->react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; } ->{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { 'no-unsafe': boolean; }; } -- -- deprecatedRules, -->deprecatedRules : { "jsx-sort-default-props": boolean; } -- -- rules: allRules, ++>react : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } ++>{ deprecatedRules, rules: allRules, } : { deprecatedRules: { "jsx-sort-default-props": boolean; }; rules: { "no-unsafe": boolean; }; } + + deprecatedRules, + >deprecatedRules : { "jsx-sort-default-props": boolean; } + + rules: allRules, ->rules : { 'no-unsafe': boolean; } ->allRules : { 'no-unsafe': boolean; } -- -- }, -- }, --}; -- --=== typescript-eslint.js === --/** -- * @typedef {{ rules: Record }} Plugin -- */ -- --/** -- * @typedef {{ plugins: Record }} Config -- */ -- --/** -- * @type {(...configs: Config[]) => void} -- */ --function config(...configs) { } ++>rules : { "no-unsafe": boolean; } ++>allRules : { "no-unsafe": boolean; } + + }, + }, +@@= skipped -38, +38 lines =@@ + * @type {(...configs: Config[]) => void} + */ + function config(...configs) { } ->config : (...configs: Config[]) => void ->configs : Config[] -- --module.exports = { config }; ++>config : (...configs: any[]) => void ++>configs : any[] + + module.exports = { config }; ->module.exports = { config } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->{ config } : { config: (...configs: Config[]) => void; } ->config : (...configs: Config[]) => void -+>tseslint.config(eslintReact) : any -+>tseslint.config : any -+>tseslint : any -+>config : any -+>eslintReact : any ++>module.exports = { config } : { config: (...configs: any[]) => void; } ++>module.exports : { config: (...configs: any[]) => void; } ++>module : { "export=": { config: (...configs: any[]) => void; }; } ++>exports : { config: (...configs: any[]) => void; } ++>{ config } : { config: (...configs: any[]) => void; } ++>config : (...configs: any[]) => void diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport.types.diff new file mode 100644 index 0000000000..fb8b338167 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/compiler/moduleResolution_explicitNodeModulesImport.types.diff @@ -0,0 +1,10 @@ +--- old.moduleResolution_explicitNodeModulesImport.types ++++ new.moduleResolution_explicitNodeModulesImport.types +@@= skipped -7, +7 lines =@@ + exports.x = 0; + >exports.x = 0 : 0 + >exports.x : 0 +->exports : typeof import("/node_modules/foo/index") ++>exports : typeof import("foo") + >x : 0 + >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.errors.txt.diff deleted file mode 100644 index 590534a253..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.requireOfJsonFileInJsFile.errors.txt -+++ new.requireOfJsonFileInJsFile.errors.txt -@@= skipped -0, +0 lines =@@ - /user.js(2,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. - /user.js(5,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -+/user.js(8,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. - /user.js(9,7): error TS2339: Property 'b' does not exist on type '{ a: number; }'. --/user.js(12,7): error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. -- -- --==== /user.js (4 errors) ==== -+/user.js(12,21): error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. -+ -+ -+==== /user.js (5 errors) ==== - const json0 = require("./json.json"); - json0.b; // Error (good) - ~ -@@= skipped -17, +18 lines =@@ - json1.b; // No error (OK since that's the type annotation) - - const js0 = require("./js.js"); -+ ~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. - json0.b; // Error (good) - ~ - !!! error TS2339: Property 'b' does not exist on type '{ a: number; }'. - - /** @type {{ b: number }} */ - const js1 = require("./js.js"); // Error (good) -- ~~~ --!!! error TS2741: Property 'b' is missing in type '{ a: number; }' but required in type '{ b: number; }'. --!!! related TS2728 /user.js:11:14: 'b' is declared here. -+ ~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './js.js'. '/js.js' implicitly has an 'any' type. - js1.b; - ==== /json.json (0 errors) ==== - { "a": 0 } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff index d9bb934eb9..e15d915b06 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/requireOfJsonFileInJsFile.types.diff @@ -1,37 +1,11 @@ --- old.requireOfJsonFileInJsFile.types +++ new.requireOfJsonFileInJsFile.types -@@= skipped -24, +24 lines =@@ - >b : number - - const js0 = require("./js.js"); -->js0 : { a: number; } -->require("./js.js") : { a: number; } -+>js0 : any -+>require("./js.js") : any - >require : any - >"./js.js" : "./js.js" - -@@= skipped -13, +13 lines =@@ - /** @type {{ b: number }} */ - const js1 = require("./js.js"); // Error (good) - >js1 : { b: number; } -->require("./js.js") : { a: number; } -+>require("./js.js") : any - >require : any - >"./js.js" : "./js.js" - -@@= skipped -13, +13 lines =@@ - { "a": 0 } - >{ "a": 0 } : { a: number; } - >"a" : number -->0 : 0 -- --=== /js.js === --module.exports = { a: 0 }; -->module.exports = { a: 0 } : { a: number; } -->module.exports : { a: number; } +@@= skipped -56, +56 lines =@@ + module.exports = { a: 0 }; + >module.exports = { a: 0 } : { a: number; } + >module.exports : { a: number; } ->module : { exports: { a: number; }; } -->exports : { a: number; } -->{ a: 0 } : { a: number; } -->a : number - >0 : 0 ++>module : { "export=": { a: number; }; } + >exports : { a: number; } + >{ a: 0 } : { a: number; } + >a : number \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff index 0215265570..a22e977b2c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.errors.txt.diff @@ -3,19 +3,19 @@ @@= skipped -0, +0 lines =@@ -use.js(5,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -use.js(6,5): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. -- -- --==== use.js (2 errors) ==== -+use.js(2,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. -+ -+ -+==== use.js (1 errors) ==== ++use.js(3,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++use.js(4,9): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + + ==== use.js (2 errors) ==== /// var mod = require('./mod'); -+ ~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. var a = new mod.A() ++ ~~~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. var b = new mod.B() ++ ~~~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. a.m('nope') - ~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff index 56f0b6cfa1..850f92019d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/chainedPrototypeAssignment.types.diff @@ -1,39 +1,29 @@ --- old.chainedPrototypeAssignment.types +++ new.chainedPrototypeAssignment.types -@@= skipped -2, +2 lines =@@ - === use.js === - /// - var mod = require('./mod'); -->mod : typeof mod -->require('./mod') : typeof mod -+>mod : any -+>require('./mod') : any - >require : (name: string) => any +@@= skipped -8, +8 lines =@@ >'./mod' : "./mod" var a = new mod.A() ->a : A ->new mod.A() : A ->mod.A : typeof A -->mod : typeof mod -->A : typeof A +>a : any +>new mod.A() : any -+>mod.A : any -+>mod : any -+>A : any ++>mod.A : { (): void; prototype: { m(n: number): number; }; } + >mod : typeof mod +->A : typeof A ++>A : { (): void; prototype: { m(n: number): number; }; } var b = new mod.B() ->b : B ->new mod.B() : B ->mod.B : typeof B -->mod : typeof mod -->B : typeof B +>b : any +>new mod.B() : any -+>mod.B : any -+>mod : any -+>B : any ++>mod.B : { (): void; prototype: { m(n: number): number; }; } + >mod : typeof mod +->B : typeof B ++>B : { (): void; prototype: { m(n: number): number; }; } a.m('nope') ->a.m('nope') : number @@ -58,70 +48,74 @@ >'not really' : "not really" === types.d.ts === -@@= skipped -40, +40 lines =@@ - - declare var exports: any; - >exports : any -- --=== mod.js === --/// --var A = function A() { +@@= skipped -38, +38 lines =@@ + === mod.js === + /// + var A = function A() { ->A : typeof A ->function A() { this.a = 1} : typeof A ->A : typeof A -- -- this.a = 1 -->this.a = 1 : 1 -->this.a : any ++>A : { (): void; prototype: { m(n: number): number; }; } ++>function A() { this.a = 1} : { (): void; prototype: { m(n: number): number; }; } ++>A : { (): void; prototype: { m(n: number): number; }; } + + this.a = 1 + >this.a = 1 : 1 + >this.a : any ->this : this -->a : any -->1 : 1 --} --var B = function B() { ++>this : any + >a : any + >1 : 1 + } + var B = function B() { ->B : typeof B ->function B() { this.b = 2} : typeof B ->B : typeof B -- -- this.b = 2 -->this.b = 2 : 2 -->this.b : any ++>B : { (): void; prototype: { m(n: number): number; }; } ++>function B() { this.b = 2} : { (): void; prototype: { m(n: number): number; }; } ++>B : { (): void; prototype: { m(n: number): number; }; } + + this.b = 2 + >this.b = 2 : 2 + >this.b : any ->this : this -->b : any -->2 : 2 --} --exports.A = A ++>this : any + >b : any + >2 : 2 + } + exports.A = A ->exports.A = A : typeof A ->exports.A : typeof A ->exports : typeof import("mod") ->A : typeof A ->A : typeof A -- --exports.B = B ++>exports.A = A : { (): void; prototype: { m(n: number): number; }; } ++>exports.A : { (): void; prototype: { m(n: number): number; }; } ++>exports : typeof import("./mod") ++>A : { (): void; prototype: { m(n: number): number; }; } ++>A : { (): void; prototype: { m(n: number): number; }; } + + exports.B = B ->exports.B = B : typeof B ->exports.B : typeof B ->exports : typeof import("mod") ->B : typeof B ->B : typeof B -- --A.prototype = B.prototype = { -->A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } -->A.prototype : { m(n: number): number; } ++>exports.B = B : { (): void; prototype: { m(n: number): number; }; } ++>exports.B : { (): void; prototype: { m(n: number): number; }; } ++>exports : typeof import("./mod") ++>B : { (): void; prototype: { m(n: number): number; }; } ++>B : { (): void; prototype: { m(n: number): number; }; } + + A.prototype = B.prototype = { + >A.prototype = B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } + >A.prototype : { m(n: number): number; } ->A : typeof A -->prototype : { m(n: number): number; } -->B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } -->B.prototype : { m(n: number): number; } ++>A : { (): void; prototype: { m(n: number): number; }; } + >prototype : { m(n: number): number; } + >B.prototype = { /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } + >B.prototype : { m(n: number): number; } ->B : typeof B -->prototype : { m(n: number): number; } -->{ /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } -- -- /** @param {number} n */ -- m(n) { -->m : (n: number) => number -->n : number -- -- return n + 1 -->n + 1 : number -->n : number -->1 : 1 -- } --} ++>B : { (): void; prototype: { m(n: number): number; }; } + >prototype : { m(n: number): number; } + >{ /** @param {number} n */ m(n) { return n + 1 }} : { m(n: number): number; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.errors.txt.diff new file mode 100644 index 0000000000..4d70a6774c --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.errors.txt.diff @@ -0,0 +1,147 @@ +--- old.checkExportsObjectAssignProperty.errors.txt ++++ new.checkExportsObjectAssignProperty.errors.txt +@@= skipped -0, +0 lines =@@ +-validator.ts(17,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. +-validator.ts(18,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. +-validator.ts(19,1): error TS2322: Type 'string' is not assignable to type 'number'. +-validator.ts(20,1): error TS2322: Type 'string' is not assignable to type 'number'. +-validator.ts(21,1): error TS2322: Type 'number' is not assignable to type 'string'. +-validator.ts(37,4): error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. +-validator.ts(38,4): error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. +-validator.ts(39,1): error TS2322: Type 'number' is not assignable to type 'string'. +-validator.ts(40,1): error TS2322: Type 'string' is not assignable to type 'number'. +-validator.ts(41,1): error TS2322: Type 'number' is not assignable to type 'string'. +- +- +-==== validator.ts (10 errors) ==== ++index.js(4,19): error TS2306: File 'mod1.js' is not a module. ++index.js(9,19): error TS2306: File 'mod2.js' is not a module. ++mod1.js(1,23): error TS2304: Cannot find name 'exports'. ++mod1.js(2,23): error TS2304: Cannot find name 'exports'. ++mod1.js(3,23): error TS2304: Cannot find name 'exports'. ++mod1.js(4,23): error TS2304: Cannot find name 'exports'. ++mod1.js(5,23): error TS2304: Cannot find name 'exports'. ++mod2.js(1,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(2,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(3,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(4,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod2.js(5,23): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++validator.ts(3,21): error TS2306: File 'mod1.js' is not a module. ++validator.ts(23,21): error TS2306: File 'mod2.js' is not a module. ++ ++ ++==== validator.ts (2 errors) ==== + import "./"; + + import m1 = require("./mod1"); ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + + m1.thing; + m1.readonlyProp; +@@= skipped -27, +33 lines =@@ + + // disallowed assignments + m1.readonlyProp = "name"; +- ~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. + m1.readonlyAccessor = 12; +- ~~~~~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. + m1.thing = "no"; +- ~~~~~~~~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + m1.rwAccessors = "no"; +- ~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + m1.setonlyAccessor = 0; +- ~~~~~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. + + import m2 = require("./mod2"); ++ ~~~~~~~~ ++!!! error TS2306: File 'mod2.js' is not a module. + + m2.thing; + m2.readonlyProp; +@@= skipped -30, +22 lines =@@ + + // disallowed assignments + m2.readonlyProp = "name"; +- ~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyProp' because it is a read-only property. + m2.readonlyAccessor = 12; +- ~~~~~~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'readonlyAccessor' because it is a read-only property. + m2.thing = 0; +- ~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. + m2.rwAccessors = "no"; +- ~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'string' is not assignable to type 'number'. + m2.setonlyAccessor = 0; +- ~~~~~~~~~~~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. + +-==== mod1.js (0 errors) ==== ++==== mod1.js (5 errors) ==== + Object.defineProperty(exports, "thing", { value: 42, writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "setonlyAccessor", { ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + /** @param {string} str */ + set(str) { + this.rwAccessors = Number(str) + } + }); + +-==== mod2.js (0 errors) ==== ++==== mod2.js (5 errors) ==== + Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + Object.defineProperty(module.exports, "setonlyAccessor", { ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. + /** @param {string} str */ + set(str) { + this.rwAccessors = Number(str) + } + }); + +-==== index.js (0 errors) ==== ++==== index.js (2 errors) ==== + /** + * @type {number} + */ + const q = require("./mod1").thing; ++ ~~~~~~~~ ++!!! error TS2306: File 'mod1.js' is not a module. + + /** + * @type {string} + */ + const u = require("./mod2").thing; ++ ~~~~~~~~ ++!!! error TS2306: File 'mod2.js' is not a module. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.types.diff similarity index 59% rename from testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types.diff rename to testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.types.diff index da18dc7591..fa0ceaf4d7 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignProperty.types.diff @@ -246,188 +246,186 @@ +>m2 : any +>setonlyAccessor : any >0 : 0 -- --=== mod1.js === --Object.defineProperty(exports, "thing", { value: 42, writable: true }); + + === mod1.js === + Object.defineProperty(exports, "thing", { value: 42, writable: true }); ->Object.defineProperty(exports, "thing", { value: 42, writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "thing", { value: 42, writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"thing" : "thing" -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- --Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ++>exports : any + >"thing" : "thing" + >{ value: 42, writable: true } : { value: number; writable: true; } + >value : number +@@= skipped -186, +186 lines =@@ + >true : true + + Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "readonlyProp", { value: "Smith", writable: false }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"readonlyProp" : "readonlyProp" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>exports : any + >"readonlyProp" : "readonlyProp" + >{ value: "Smith", writable: false } : { value: string; writable: false; } + >value : string +@@= skipped -13, +13 lines =@@ + >false : false + + Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"rwAccessors" : "rwAccessors" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ++>exports : any + >"rwAccessors" : "rwAccessors" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } + >get : () => number +@@= skipped -13, +13 lines =@@ + >_ : any + + Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "readonlyAccessor", { get() { return 21.75 } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"readonlyAccessor" : "readonlyAccessor" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(exports, "setonlyAccessor", { ++>exports : any + >"readonlyAccessor" : "readonlyAccessor" + >{ get() { return 21.75 } } : { get(): number; } + >get : () => number + >21.75 : 21.75 + + Object.defineProperty(exports, "setonlyAccessor", { ->Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"setonlyAccessor" : "setonlyAccessor" -->{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.rwAccessors = Number(str) -->this.rwAccessors = Number(str) : number -->this.rwAccessors : any -->this : any -->rwAccessors : any -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); -- --=== mod2.js === --Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ++>exports : any + >"setonlyAccessor" : "setonlyAccessor" + >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + +@@= skipped -37, +37 lines =@@ + + === mod2.js === + Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }); ->Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "thing", { value: "yes", writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"thing" : "thing" -->{ value: "yes", writable: true } : { value: string; writable: true; } -->value : string -->"yes" : "yes" -->writable : true -->true : true -- --Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ++>module.exports : any ++>module : any ++>exports : any + >"thing" : "thing" + >{ value: "yes", writable: true } : { value: string; writable: true; } + >value : string +@@= skipped -15, +15 lines =@@ + >true : true + + Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }); ->Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "readonlyProp", { value: "Smith", writable: false }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"readonlyProp" : "readonlyProp" -->{ value: "Smith", writable: false } : { value: string; writable: false; } -->value : string -->"Smith" : "Smith" -->writable : false -->false : false -- --Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ++>module.exports : any ++>module : any ++>exports : any + >"readonlyProp" : "readonlyProp" + >{ value: "Smith", writable: false } : { value: string; writable: false; } + >value : string +@@= skipped -15, +15 lines =@@ + >false : false + + Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }); ->Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "rwAccessors", { get() { return 98122 }, set(_) { /*ignore*/ } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"rwAccessors" : "rwAccessors" -->{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } -->get : () => number -->98122 : 98122 -->set : (_: any) => void -->_ : any -- --Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ++>module.exports : any ++>module : any ++>exports : any + >"rwAccessors" : "rwAccessors" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } + >get : () => number +@@= skipped -15, +15 lines =@@ + >_ : any + + Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }); ->Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "readonlyAccessor", { get() { return 21.75 } }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"readonlyAccessor" : "readonlyAccessor" -->{ get() { return 21.75 } } : { get(): number; } -->get : () => number -->21.75 : 21.75 -- --Object.defineProperty(module.exports, "setonlyAccessor", { ++>module.exports : any ++>module : any ++>exports : any + >"readonlyAccessor" : "readonlyAccessor" + >{ get() { return 21.75 } } : { get(): number; } + >get : () => number + >21.75 : 21.75 + + Object.defineProperty(module.exports, "setonlyAccessor", { ->Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, "setonlyAccessor", { /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }}) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"setonlyAccessor" : "setonlyAccessor" -->{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } -- -- /** @param {string} str */ -- set(str) { -->set : (str: string) => void -->str : string -- -- this.rwAccessors = Number(str) -->this.rwAccessors = Number(str) : number -->this.rwAccessors : any -->this : any -->rwAccessors : any -->Number(str) : number -->Number : NumberConstructor -->str : string -- } --}); -- --=== index.js === --/** -- * @type {number} -- */ --const q = require("./mod1").thing; -->q : number ++>module.exports : any ++>module : any ++>exports : any + >"setonlyAccessor" : "setonlyAccessor" + >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } + +@@= skipped -45, +45 lines =@@ + */ + const q = require("./mod1").thing; + >q : number ->require("./mod1").thing : number ->require("./mod1") : typeof import("mod1") -->require : any -->"./mod1" : "./mod1" ++>require("./mod1").thing : any ++>require("./mod1") : any + >require : any + >"./mod1" : "./mod1" ->thing : number -- --/** -- * @type {string} -- */ --const u = require("./mod2").thing; -->u : string ++>thing : any + + /** + * @type {string} + */ + const u = require("./mod2").thing; + >u : string ->require("./mod2").thing : string ->require("./mod2") : typeof import("mod2") -->require : any -->"./mod2" : "./mod2" ++>require("./mod2").thing : any ++>require("./mod2") : any + >require : any + >"./mod2" : "./mod2" ->thing : string ++>thing : any diff --git a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff similarity index 63% rename from testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff rename to testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff index 79793c3f2c..e79888a53e 100644 --- a/testdata/baselines/reference/submodule/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.errors.txt.diff @@ -9,19 +9,22 @@ - - -==== validator.ts (5 errors) ==== -+validator.ts(3,25): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++mod1.js(6,5): error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. ++validator.ts(5,12): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== validator.ts (1 errors) ==== import "./"; import Person = require("./mod1"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. const m1 = new Person("Name") ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. -@@= skipped -24, +22 lines =@@ + m1.thing; + m1.readonlyProp; +@@= skipped -24, +23 lines =@@ // disallowed assignments m1.readonlyProp = "name"; @@ -39,6 +42,20 @@ m1.setonlyAccessor = 0; - ~~~~~~~~~~~~~~~~~~ -!!! error TS2322: Type 'number' is not assignable to type 'string'. - - - ==== mod1.js (0 errors) ==== \ No newline at end of file +- +- +-==== mod1.js (0 errors) ==== ++ ++ ++==== mod1.js (1 errors) ==== + /** + * @constructor + * @param {string} name + */ + function Person(name) { + this.name = name; ++ ~~~~ ++!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation. + } + Person.prototype.describe = function () { + return "Person called " + this.name; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff new file mode 100644 index 0000000000..987939191c --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkExportsObjectAssignPrototypeProperty.types.diff @@ -0,0 +1,246 @@ +--- old.checkExportsObjectAssignPrototypeProperty.types ++++ new.checkExportsObjectAssignPrototypeProperty.types +@@= skipped -3, +3 lines =@@ + import "./"; + + import Person = require("./mod1"); +->Person : typeof Person ++>Person : (name: string) => void + + const m1 = new Person("Name") +->m1 : Person +->new Person("Name") : Person +->Person : typeof Person ++>m1 : any ++>new Person("Name") : any ++>Person : (name: string) => void + >"Name" : "Name" + + m1.thing; +->m1.thing : number +->m1 : Person +->thing : number ++>m1.thing : any ++>m1 : any ++>thing : any + + m1.readonlyProp; +->m1.readonlyProp : string +->m1 : Person +->readonlyProp : string ++>m1.readonlyProp : any ++>m1 : any ++>readonlyProp : any + + m1.rwAccessors; +->m1.rwAccessors : number +->m1 : Person +->rwAccessors : number ++>m1.rwAccessors : any ++>m1 : any ++>rwAccessors : any + + m1.readonlyAccessor; +->m1.readonlyAccessor : number +->m1 : Person +->readonlyAccessor : number ++>m1.readonlyAccessor : any ++>m1 : any ++>readonlyAccessor : any + + m1.setonlyAccessor; +->m1.setonlyAccessor : string +->m1 : Person +->setonlyAccessor : string ++>m1.setonlyAccessor : any ++>m1 : any ++>setonlyAccessor : any + + // allowed assignments + m1.thing = 10; + >m1.thing = 10 : 10 +->m1.thing : number +->m1 : Person +->thing : number ++>m1.thing : any ++>m1 : any ++>thing : any + >10 : 10 + + m1.rwAccessors = 11; + >m1.rwAccessors = 11 : 11 +->m1.rwAccessors : number +->m1 : Person +->rwAccessors : number ++>m1.rwAccessors : any ++>m1 : any ++>rwAccessors : any + >11 : 11 + + m1.setonlyAccessor = "yes"; + >m1.setonlyAccessor = "yes" : "yes" +->m1.setonlyAccessor : string +->m1 : Person +->setonlyAccessor : string ++>m1.setonlyAccessor : any ++>m1 : any ++>setonlyAccessor : any + >"yes" : "yes" + + // disallowed assignments + m1.readonlyProp = "name"; + >m1.readonlyProp = "name" : "name" + >m1.readonlyProp : any +->m1 : Person ++>m1 : any + >readonlyProp : any + >"name" : "name" + + m1.readonlyAccessor = 12; + >m1.readonlyAccessor = 12 : 12 + >m1.readonlyAccessor : any +->m1 : Person ++>m1 : any + >readonlyAccessor : any + >12 : 12 + + m1.thing = "no"; + >m1.thing = "no" : "no" +->m1.thing : number +->m1 : Person +->thing : number ++>m1.thing : any ++>m1 : any ++>thing : any + >"no" : "no" + + m1.rwAccessors = "no"; + >m1.rwAccessors = "no" : "no" +->m1.rwAccessors : number +->m1 : Person +->rwAccessors : number ++>m1.rwAccessors : any ++>m1 : any ++>rwAccessors : any + >"no" : "no" + + m1.setonlyAccessor = 0; + >m1.setonlyAccessor = 0 : 0 +->m1.setonlyAccessor : string +->m1 : Person +->setonlyAccessor : string ++>m1.setonlyAccessor : any ++>m1 : any ++>setonlyAccessor : any + >0 : 0 + + +@@= skipped -98, +98 lines =@@ + * @param {string} name + */ + function Person(name) { +->Person : typeof Person ++>Person : (name: string) => void + >name : string + + this.name = name; + >this.name = name : string + >this.name : any +->this : this ++>this : any + >name : any + >name : string + } +@@= skipped -14, +14 lines =@@ + >Person.prototype.describe = function () { return "Person called " + this.name;} : () => string + >Person.prototype.describe : any + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >describe : any + >function () { return "Person called " + this.name;} : () => string +@@= skipped -8, +8 lines =@@ + return "Person called " + this.name; + >"Person called " + this.name : string + >"Person called " : "Person called " +->this.name : string +->this : this +->name : string ++>this.name : any ++>this : any ++>name : any + + }; + Object.defineProperty(Person.prototype, "thing", { value: 42, writable: true }); +@@= skipped -11, +11 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"thing" : "thing" + >{ value: 42, writable: true } : { value: number; writable: true; } +@@= skipped -15, +15 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"readonlyProp" : "readonlyProp" + >{ value: "Smith", writable: false } : { value: string; writable: false; } +@@= skipped -15, +15 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"rwAccessors" : "rwAccessors" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } +@@= skipped -15, +15 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"readonlyAccessor" : "readonlyAccessor" + >{ get() { return 21.75 } } : { get(): number; } +@@= skipped -13, +13 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Person.prototype : any +->Person : typeof Person ++>Person : (name: string) => void + >prototype : any + >"setonlyAccessor" : "setonlyAccessor" + >{ /** @param {string} str */ set(str) { this.rwAccessors = Number(str) }} : { set(str: string): void; } +@@= skipped -12, +12 lines =@@ + + this.rwAccessors = Number(str) + >this.rwAccessors = Number(str) : number +->this.rwAccessors : number +->this : this +->rwAccessors : number ++>this.rwAccessors : any ++>this : any ++>rwAccessors : any + >Number(str) : number + >Number : NumberConstructor + >str : string + } + }); + module.exports = Person; +->module.exports = Person : typeof Person +->module.exports : typeof Person +->module : { exports: typeof Person; } +->exports : typeof Person +->Person : typeof Person ++>module.exports = Person : (name: string) => void ++>module.exports : (name: string) => void ++>module : { Person(name: string): void; } ++>exports : (name: string) => void ++>Person : (name: string) => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff new file mode 100644 index 0000000000..a3a773a7c6 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.errors.txt.diff @@ -0,0 +1,106 @@ +--- old.checkObjectDefineProperty.errors.txt ++++ new.checkObjectDefineProperty.errors.txt +@@= skipped -0, +0 lines =@@ +-validate.ts(14,3): error TS2540: Cannot assign to 'lastName' because it is a read-only property. +-validate.ts(15,3): error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. +-validate.ts(16,1): error TS2322: Type 'number' is not assignable to type 'string'. +-validate.ts(17,3): error TS2540: Cannot assign to 'middleInit' because it is a read-only property. +- +- +-==== validate.ts (4 errors) ==== ++index.js(19,10): error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. ++index.js(23,11): error TS2339: Property 'zip' does not exist on type '{}'. ++index.js(28,11): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(3,3): error TS2339: Property 'name' does not exist on type '{}'. ++validate.ts(4,3): error TS2339: Property 'middleInit' does not exist on type '{}'. ++validate.ts(5,3): error TS2339: Property 'lastName' does not exist on type '{}'. ++validate.ts(6,3): error TS2339: Property 'zip' does not exist on type '{}'. ++validate.ts(7,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(8,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(10,3): error TS2339: Property 'name' does not exist on type '{}'. ++validate.ts(11,3): error TS2339: Property 'zip' does not exist on type '{}'. ++validate.ts(12,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(14,3): error TS2339: Property 'lastName' does not exist on type '{}'. ++validate.ts(15,3): error TS2339: Property 'houseNumber' does not exist on type '{}'. ++validate.ts(16,3): error TS2339: Property 'zipStr' does not exist on type '{}'. ++validate.ts(17,3): error TS2339: Property 'middleInit' does not exist on type '{}'. ++ ++ ++==== validate.ts (13 errors) ==== + // Validate in TS as simple validations would usually be interpreted as more special assignments + import x = require("./"); + x.name; ++ ~~~~ ++!!! error TS2339: Property 'name' does not exist on type '{}'. + x.middleInit; ++ ~~~~~~~~~~ ++!!! error TS2339: Property 'middleInit' does not exist on type '{}'. + x.lastName; ++ ~~~~~~~~ ++!!! error TS2339: Property 'lastName' does not exist on type '{}'. + x.zip; ++ ~~~ ++!!! error TS2339: Property 'zip' does not exist on type '{}'. + x.houseNumber; ++ ~~~~~~~~~~~ ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. + x.zipStr; ++ ~~~~~~ ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. + + x.name = "Another"; ++ ~~~~ ++!!! error TS2339: Property 'name' does not exist on type '{}'. + x.zip = 98123; ++ ~~~ ++!!! error TS2339: Property 'zip' does not exist on type '{}'. + x.zipStr = "OK"; ++ ~~~~~~ ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. + + x.lastName = "should fail"; + ~~~~~~~~ +-!!! error TS2540: Cannot assign to 'lastName' because it is a read-only property. ++!!! error TS2339: Property 'lastName' does not exist on type '{}'. + x.houseNumber = 12; // should also fail + ~~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'houseNumber' because it is a read-only property. ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. + x.zipStr = 12; // should fail +- ~~~~~~~~ +-!!! error TS2322: Type 'number' is not assignable to type 'string'. ++ ~~~~~~ ++!!! error TS2339: Property 'zipStr' does not exist on type '{}'. + x.middleInit = "R"; // should also fail + ~~~~~~~~~~ +-!!! error TS2540: Cannot assign to 'middleInit' because it is a read-only property. ++!!! error TS2339: Property 'middleInit' does not exist on type '{}'. + +-==== index.js (0 errors) ==== ++==== index.js (3 errors) ==== + const x = {}; + Object.defineProperty(x, "name", { value: "Charles", writable: true }); + Object.defineProperty(x, "middleInit", { value: "H" }); +@@= skipped -50, +80 lines =@@ + function takeName(named) { return named.name; } + + takeName(x); ++ ~ ++!!! error TS2741: Property 'name' is missing in type '{}' but required in type '{ name: string; }'. ++!!! related TS2728 index.js:15:13: 'name' is declared here. + /** + * @type {number} + */ + var a = x.zip; ++ ~~~ ++!!! error TS2339: Property 'zip' does not exist on type '{}'. + + /** + * @type {number} + */ + var b = x.houseNumber; ++ ~~~~~~~~~~~ ++!!! error TS2339: Property 'houseNumber' does not exist on type '{}'. + + const returnExemplar = () => x; + const needsExemplar = (_ = x) => void 0; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff new file mode 100644 index 0000000000..5b03a1f204 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkObjectDefineProperty.types.diff @@ -0,0 +1,293 @@ +--- old.checkObjectDefineProperty.types ++++ new.checkObjectDefineProperty.types +@@= skipped -2, +2 lines =@@ + === validate.ts === + // Validate in TS as simple validations would usually be interpreted as more special assignments + import x = require("./"); +->x : typeof x ++>x : {} + + x.name; +->x.name : string +->x : typeof x +->name : string ++>x.name : any ++>x : {} ++>name : any + + x.middleInit; +->x.middleInit : string +->x : typeof x +->middleInit : string ++>x.middleInit : any ++>x : {} ++>middleInit : any + + x.lastName; +->x.lastName : string +->x : typeof x +->lastName : string ++>x.lastName : any ++>x : {} ++>lastName : any + + x.zip; +->x.zip : number +->x : typeof x +->zip : number ++>x.zip : any ++>x : {} ++>zip : any + + x.houseNumber; +->x.houseNumber : number +->x : typeof x +->houseNumber : number ++>x.houseNumber : any ++>x : {} ++>houseNumber : any + + x.zipStr; +->x.zipStr : string +->x : typeof x +->zipStr : string ++>x.zipStr : any ++>x : {} ++>zipStr : any + + x.name = "Another"; + >x.name = "Another" : "Another" +->x.name : string +->x : typeof x +->name : string ++>x.name : any ++>x : {} ++>name : any + >"Another" : "Another" + + x.zip = 98123; + >x.zip = 98123 : 98123 +->x.zip : number +->x : typeof x +->zip : number ++>x.zip : any ++>x : {} ++>zip : any + >98123 : 98123 + + x.zipStr = "OK"; + >x.zipStr = "OK" : "OK" +->x.zipStr : string +->x : typeof x +->zipStr : string ++>x.zipStr : any ++>x : {} ++>zipStr : any + >"OK" : "OK" + + x.lastName = "should fail"; + >x.lastName = "should fail" : "should fail" + >x.lastName : any +->x : typeof x ++>x : {} + >lastName : any + >"should fail" : "should fail" + + x.houseNumber = 12; // should also fail + >x.houseNumber = 12 : 12 + >x.houseNumber : any +->x : typeof x ++>x : {} + >houseNumber : any + >12 : 12 + + x.zipStr = 12; // should fail + >x.zipStr = 12 : 12 +->x.zipStr : string +->x : typeof x +->zipStr : string ++>x.zipStr : any ++>x : {} ++>zipStr : any + >12 : 12 + + x.middleInit = "R"; // should also fail + >x.middleInit = "R" : "R" + >x.middleInit : any +->x : typeof x ++>x : {} + >middleInit : any + >"R" : "R" + + === index.js === + const x = {}; +->x : typeof x ++>x : {} + >{} : {} + + Object.defineProperty(x, "name", { value: "Charles", writable: true }); +->Object.defineProperty(x, "name", { value: "Charles", writable: true }) : typeof x ++>Object.defineProperty(x, "name", { value: "Charles", writable: true }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"name" : "name" + >{ value: "Charles", writable: true } : { value: string; writable: true; } + >value : string +@@= skipped -100, +100 lines =@@ + >true : true + + Object.defineProperty(x, "middleInit", { value: "H" }); +->Object.defineProperty(x, "middleInit", { value: "H" }) : typeof x ++>Object.defineProperty(x, "middleInit", { value: "H" }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"middleInit" : "middleInit" + >{ value: "H" } : { value: string; } + >value : string + >"H" : "H" + + Object.defineProperty(x, "lastName", { value: "Smith", writable: false }); +->Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : typeof x ++>Object.defineProperty(x, "lastName", { value: "Smith", writable: false }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"lastName" : "lastName" + >{ value: "Smith", writable: false } : { value: string; writable: false; } + >value : string +@@= skipped -24, +24 lines =@@ + >false : false + + Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }); +->Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : typeof x ++>Object.defineProperty(x, "zip", { get() { return 98122 }, set(_) { /*ignore*/ } }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"zip" : "zip" + >{ get() { return 98122 }, set(_) { /*ignore*/ } } : { get(): number; set(_: any): void; } + >get : () => number +@@= skipped -13, +13 lines =@@ + >_ : any + + Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }); +->Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : typeof x ++>Object.defineProperty(x, "houseNumber", { get() { return 21.75 } }) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"houseNumber" : "houseNumber" + >{ get() { return 21.75 } } : { get(): number; } + >get : () => number + >21.75 : 21.75 + + Object.defineProperty(x, "zipStr", { +->Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : typeof x ++>Object.defineProperty(x, "zipStr", { /** @param {string} str */ set(str) { this.zip = Number(str) }}) : {} + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T +->x : typeof x ++>x : {} + >"zipStr" : "zipStr" + >{ /** @param {string} str */ set(str) { this.zip = Number(str) }} : { set(str: string): void; } + +@@= skipped -48, +48 lines =@@ + takeName(x); + >takeName(x) : string + >takeName : (named: { name: string; }) => string +->x : typeof x ++>x : {} + + /** + * @type {number} + */ + var a = x.zip; + >a : number +->x.zip : number +->x : typeof x +->zip : number ++>x.zip : any ++>x : {} ++>zip : any + + /** + * @type {number} + */ + var b = x.houseNumber; + >b : number +->x.houseNumber : number +->x : typeof x +->houseNumber : number ++>x.houseNumber : any ++>x : {} ++>houseNumber : any + + const returnExemplar = () => x; +->returnExemplar : () => typeof x +->() => x : () => typeof x +->x : typeof x ++>returnExemplar : () => {} ++>() => x : () => {} ++>x : {} + + const needsExemplar = (_ = x) => void 0; +->needsExemplar : (_?: typeof x) => undefined +->(_ = x) => void 0 : (_?: typeof x) => undefined +->_ : typeof x +->x : typeof x ++>needsExemplar : (_?: {}) => undefined ++>(_ = x) => void 0 : (_?: {}) => undefined ++>_ : {} ++>x : {} + >void 0 : undefined + >0 : 0 + +@@= skipped -44, +44 lines =@@ + * @param {typeof needsExemplar} b + */ + function match(a, b) {} +->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void +->a : () => typeof x +->b : (_?: typeof x) => undefined ++>match : (a: () => {}, b: (_?: {}) => undefined) => void ++>a : () => {} ++>b : (_?: {}) => undefined + + match(() => expected, (x = expected) => void 0); + >match(() => expected, (x = expected) => void 0) : void +->match : (a: typeof returnExemplar, b: typeof needsExemplar) => void ++>match : (a: () => {}, b: (_?: {}) => undefined) => void + >() => expected : () => { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } + >expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } +->(x = expected) => void 0 : (x?: typeof x | undefined) => undefined +->x : typeof x | undefined ++>(x = expected) => void 0 : (x?: {} | undefined) => undefined ++>x : {} | undefined + >expected : { name: string; readonly middleInit: string; readonly lastName: string; zip: number; readonly houseNumber: number; zipStr: string; } + >void 0 : undefined + >0 : 0 + + module.exports = x; +->module.exports = x : typeof x +->module.exports : typeof x +->module : { exports: typeof x; } +->exports : typeof x +->x : typeof x ++>module.exports = x : {} ++>module.exports : {} ++>module : { readonly x: {}; } ++>exports : {} ++>x : {} diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff index 9ac8e78746..2ef436de9d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.errors.txt.diff @@ -11,13 +11,19 @@ - - -==== importer.js (7 errors) ==== -+importer.js(1,21): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++importer.js(1,21): error TS2306: File 'mod1.js' is not a module. ++mod1.js(2,23): error TS2304: Cannot find name 'exports'. ++mod1.js(8,23): error TS2304: Cannot find name 'exports'. ++mod1.js(11,23): error TS2304: Cannot find name 'exports'. ++mod1.js(14,23): error TS2304: Cannot find name 'exports'. ++mod1.js(15,23): error TS2304: Cannot find name 'exports'. ++mod1.js(16,23): error TS2304: Cannot find name 'exports'. + + +==== importer.js (1 errors) ==== const mod = require("./mod1"); + ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++!!! error TS2306: File 'mod1.js' is not a module. mod.thing; mod.other; - ~~~~~ @@ -28,7 +34,7 @@ mod.bad1; mod.bad2; mod.bad3; -@@= skipped -22, +14 lines =@@ +@@= skipped -22, +20 lines =@@ mod.thing = 0; mod.other = 0; @@ -47,5 +53,34 @@ - ~~~~ -!!! error TS2540: Cannot assign to 'bad3' because it is a read-only property. - ==== mod1.js (0 errors) ==== - const obj = { value: 42, writable: true }; \ No newline at end of file +-==== mod1.js (0 errors) ==== ++==== mod1.js (6 errors) ==== + const obj = { value: 42, writable: true }; + Object.defineProperty(exports, "thing", obj); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + + /** + * @type {string} + */ + let str = /** @type {string} */("other"); + Object.defineProperty(exports, str, { value: 42, writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + + const propName = "prop" + Object.defineProperty(exports, propName, { value: 42, writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + + + Object.defineProperty(exports, "bad1", { }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + Object.defineProperty(exports, "bad3", { writable: true }); ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff index b40bb0b226..b905bf5251 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/checkOtherObjectAssignProperty.types.diff @@ -101,93 +101,85 @@ +>mod : any >bad3 : any >0 : 0 -- --=== mod1.js === --const obj = { value: 42, writable: true }; -->obj : { value: number; writable: boolean; } -->{ value: 42, writable: true } : { value: number; writable: boolean; } -->value : number -->42 : 42 -->writable : boolean -->true : true -- --Object.defineProperty(exports, "thing", obj); + +@@= skipped -88, +88 lines =@@ + >true : true + + Object.defineProperty(exports, "thing", obj); ->Object.defineProperty(exports, "thing", obj) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "thing", obj) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"thing" : "thing" -->obj : { value: number; writable: boolean; } -- --/** -- * @type {string} -- */ --let str = /** @type {string} */("other"); -->str : string -->("other") : string -->"other" : "other" -- --Object.defineProperty(exports, str, { value: 42, writable: true }); ++>exports : any + >"thing" : "thing" + >obj : { value: number; writable: boolean; } + +@@= skipped -17, +17 lines =@@ + >"other" : "other" + + Object.defineProperty(exports, str, { value: 42, writable: true }); ->Object.defineProperty(exports, str, { value: 42, writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, str, { value: 42, writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->str : string -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- --const propName = "prop" -->propName : "prop" -->"prop" : "prop" -- --Object.defineProperty(exports, propName, { value: 42, writable: true }); ++>exports : any + >str : string + >{ value: 42, writable: true } : { value: number; writable: true; } + >value : number +@@= skipped -17, +17 lines =@@ + >"prop" : "prop" + + Object.defineProperty(exports, propName, { value: 42, writable: true }); ->Object.defineProperty(exports, propName, { value: 42, writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, propName, { value: 42, writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->propName : "prop" -->{ value: 42, writable: true } : { value: number; writable: true; } -->value : number -->42 : 42 -->writable : true -->true : true -- -- --Object.defineProperty(exports, "bad1", { }); ++>exports : any + >propName : "prop" + >{ value: 42, writable: true } : { value: number; writable: true; } + >value : number +@@= skipped -14, +14 lines =@@ + + + Object.defineProperty(exports, "bad1", { }); ->Object.defineProperty(exports, "bad1", { }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "bad1", { }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"bad1" : "bad1" -->{ } : {} -- --Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ++>exports : any + >"bad1" : "bad1" + >{ } : {} + + Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }); ->Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "bad2", { get() { return 12 }, value: "no" }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"bad2" : "bad2" -->{ get() { return 12 }, value: "no" } : { get(): number; value: string; } -->get : () => number -->12 : 12 -->value : string -->"no" : "no" -- --Object.defineProperty(exports, "bad3", { writable: true }); ++>exports : any + >"bad2" : "bad2" + >{ get() { return 12 }, value: "no" } : { get(): number; value: string; } + >get : () => number +@@= skipped -22, +22 lines =@@ + >"no" : "no" + + Object.defineProperty(exports, "bad3", { writable: true }); ->Object.defineProperty(exports, "bad3", { writable: true }) : typeof import("mod1") -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(exports, "bad3", { writable: true }) : any + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->exports : typeof import("mod1") -->"bad3" : "bad3" -->{ writable: true } : { writable: true; } -->writable : true -->true : true ++>exports : any + >"bad3" : "bad3" + >{ writable: true } : { writable: true; } + >writable : true \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff new file mode 100644 index 0000000000..18e8e7a09d --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.commonJSAliasedExport.errors.txt ++++ new.commonJSAliasedExport.errors.txt +@@= skipped -0, +0 lines =@@ +- ++bug43713.js(1,9): error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. ++commonJSAliasedExport.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. ++ ++ ++==== bug43713.js (1 errors) ==== ++ const { funky } = require('./commonJSAliasedExport'); ++ ~~~~~ ++!!! error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'. ++ /** @type {boolean} */ ++ var diddy ++ var diddy = funky(1) ++ ++ ++==== commonJSAliasedExport.js (2 errors) ==== ++ const donkey = (ast) => ast; ++ ++ function funky(declaration) { ++ return false; ++ } ++ module.exports = donkey; ++ ~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. ++ module.exports.funky = funky; ++ ~~~~~ ++!!! error TS2339: Property 'funky' does not exist on type '(ast: any) => any'. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff index d93407dc34..77a534523c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSAliasedExport.types.diff @@ -5,12 +5,10 @@ === bug43713.js === const { funky } = require('./commonJSAliasedExport'); ->funky : (declaration: any) => boolean -->require('./commonJSAliasedExport') : (ast: any) => any +>funky : any -+>require('./commonJSAliasedExport') : any + >require('./commonJSAliasedExport') : (ast: any) => any >require : any >'./commonJSAliasedExport' : "./commonJSAliasedExport" - @@= skipped -11, +11 lines =@@ var diddy = funky(1) @@ -21,33 +19,31 @@ +>funky : any >1 : 1 -- --=== commonJSAliasedExport.js === --const donkey = (ast) => ast; -->donkey : (ast: any) => any -->(ast) => ast : (ast: any) => any -->ast : any -->ast : any -- --function funky(declaration) { -->funky : (declaration: any) => boolean -->declaration : any -- -- return false; -->false : false --} --module.exports = donkey; + +@@= skipped -20, +20 lines =@@ + >false : false + } + module.exports = donkey; ->module.exports = donkey : { (ast: any): any; funky: (declaration: any) => boolean; } ->module.exports : { (ast: any): any; funky: (declaration: any) => boolean; } ->module : { exports: { (ast: any): any; funky: (declaration: any) => boolean; }; } ->exports : { (ast: any): any; funky: (declaration: any) => boolean; } -->donkey : (ast: any) => any -- --module.exports.funky = funky; -->module.exports.funky = funky : (declaration: any) => boolean ++>module.exports = donkey : (ast: any) => any ++>module.exports : (ast: any) => any ++>module : { readonly donkey: (ast: any) => any; } ++>exports : (ast: any) => any + >donkey : (ast: any) => any + + module.exports.funky = funky; + >module.exports.funky = funky : (declaration: any) => boolean ->module.exports.funky : (declaration: any) => boolean ->module.exports : { (ast: any): any; funky: (declaration: any) => boolean; } ->module : { exports: { (ast: any): any; funky: (declaration: any) => boolean; }; } ->exports : { (ast: any): any; funky: (declaration: any) => boolean; } ->funky : (declaration: any) => boolean -->funky : (declaration: any) => boolean ++>module.exports.funky : any ++>module.exports : (ast: any) => any ++>module : { readonly donkey: (ast: any) => any; } ++>exports : (ast: any) => any ++>funky : any + >funky : (declaration: any) => boolean diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff index 856ade0f5e..715a57c3bc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/commonJSReexport.types.diff @@ -1,55 +1,54 @@ --- old.commonJSReexport.types +++ new.commonJSReexport.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === main.js === const { hardline } = require('./second').nested; -->hardline : { type: string; } + >hardline : { type: string; } ->require('./second').nested : typeof import("first") ->require('./second') : { nested: typeof import("first"); } -+>hardline : any -+>require('./second').nested : any -+>require('./second') : any ++>require('./second').nested : { hardline: { type: string; }; } ++>require('./second') : { nested: { hardline: { type: string; }; }; } >require : any >'./second' : "./second" ->nested : typeof import("first") -+>nested : any ++>nested : { hardline: { type: string; }; } hardline -->hardline : { type: string; } -- --=== first.js === --const hardline = { type: "hard" } -->hardline : { type: string; } -->{ type: "hard" } : { type: string; } -->type : string -->"hard" : "hard" -- --module.exports = { + >hardline : { type: string; } +@@= skipped -17, +17 lines =@@ + >"hard" : "hard" + + module.exports = { ->module.exports = { hardline} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ hardline} : { hardline: { type: string; }; } -- -- hardline -->hardline : { type: string; } --} -- -- --=== second.js === --module.exports = { ++>module.exports = { hardline} : { hardline: { type: string; }; } ++>module.exports : { hardline: { type: string; }; } ++>module : { "export=": { hardline: { type: string; }; }; } ++>exports : { hardline: { type: string; }; } + >{ hardline} : { hardline: { type: string; }; } + + hardline +@@= skipped -13, +13 lines =@@ + + === second.js === + module.exports = { ->module.exports = { nested: require('./first')} : { nested: typeof import("first"); } ->module.exports : { nested: typeof import("first"); } ->module : { exports: { nested: typeof import("first"); }; } ->exports : { nested: typeof import("first"); } ->{ nested: require('./first')} : { nested: typeof import("first"); } -- -- nested: require('./first') ++>module.exports = { nested: require('./first')} : { nested: { hardline: { type: string; }; }; } ++>module.exports : { nested: { hardline: { type: string; }; }; } ++>module : { "export=": { nested: { hardline: { type: string; }; }; }; } ++>exports : { nested: { hardline: { type: string; }; }; } ++>{ nested: require('./first')} : { nested: { hardline: { type: string; }; }; } + + nested: require('./first') ->nested : typeof import("first") ->require('./first') : typeof import("first") -->require : any -->'./first' : "./first" -- --}; -+>hardline : any ++>nested : { hardline: { type: string; }; } ++>require('./first') : { hardline: { type: string; }; } + >require : any + >'./first' : "./first" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff index 53a8688d1c..90fb3fbf2c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsClassExtendsVisibility.types.diff @@ -1,23 +1,6 @@ --- old.jsDeclarationsClassExtendsVisibility.types +++ new.jsDeclarationsClassExtendsVisibility.types -@@= skipped -1, +1 lines =@@ - - === cls.js === - const Bar = require("./bar"); -->Bar : typeof Bar -->require("./bar") : typeof Bar -+>Bar : any -+>require("./bar") : any - >require : any - >"./bar" : "./bar" - -@@= skipped -20, +20 lines =@@ - }; - class Foo extends Bar {} - >Foo : Foo -->Bar : Bar -+>Bar : any - +@@= skipped -26, +26 lines =@@ module.exports = Foo; >module.exports = Foo : typeof Foo >module.exports : typeof Foo @@ -35,17 +18,15 @@ +>module : { Foo: typeof Foo; } >exports : typeof Foo ->Strings : { a: string; b: string; } -->Strings : { a: string; b: string; } -- --=== bar.js === --class Bar {} -->Bar : Bar -- --module.exports = Bar; -->module.exports = Bar : typeof Bar -->module.exports : typeof Bar -->module : { exports: typeof Bar; } -->exports : typeof Bar -->Bar : typeof Bar +>Strings : any -+>Strings : { a: string; b: string; } + >Strings : { a: string; b: string; } + + === bar.js === +@@= skipped -20, +20 lines =@@ + module.exports = Bar; + >module.exports = Bar : typeof Bar + >module.exports : typeof Bar +->module : { exports: typeof Bar; } ++>module : { Bar: typeof Bar; } + >exports : typeof Bar + >Bar : typeof Bar diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff index fde8dbbe09..25ad7bbe79 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsCommonjsRelativePath.types.diff @@ -1,47 +1,38 @@ --- old.jsDeclarationsCommonjsRelativePath.types +++ new.jsDeclarationsCommonjsRelativePath.types -@@= skipped -4, +4 lines =@@ - >'use strict' : "use strict" - +@@= skipped -6, +6 lines =@@ const Thing = require('./thing').Thing -->Thing : typeof Thing -->require('./thing').Thing : typeof Thing + >Thing : typeof Thing + >require('./thing').Thing : typeof Thing ->require('./thing') : typeof import("thing") -+>Thing : any -+>require('./thing').Thing : any -+>require('./thing') : any ++>require('./thing') : { Thing: typeof Thing; } >require : any >'./thing' : "./thing" -->Thing : typeof Thing -- --module.exports = { Thing } + >Thing : typeof Thing + + module.exports = { Thing } ->module.exports = { Thing } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Thing } : { Thing: typeof Thing; } -->Thing : typeof Thing -- --=== thing.js === --'use strict'; -->'use strict' : "use strict" -- --class Thing {} -->Thing : Thing -- --module.exports = { Thing } ++>module.exports = { Thing } : { Thing: typeof Thing; } ++>module.exports : { Thing: typeof Thing; } ++>module : { "export=": { Thing: typeof Thing; }; } ++>exports : { Thing: typeof Thing; } + >{ Thing } : { Thing: typeof Thing; } + >Thing : typeof Thing + +@@= skipped -21, +21 lines =@@ + >Thing : Thing + + module.exports = { Thing } ->module.exports = { Thing } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Thing } : { Thing: typeof Thing; } -->Thing : typeof Thing -+>Thing : any -+ -+module.exports = { Thing } -+>module.exports = { Thing } : { Thing: any; } -+>module.exports : { Thing: any; } -+>module : { "export=": { Thing: any; }; } -+>exports : { Thing: any; } -+>{ Thing } : { Thing: any; } -+>Thing : any ++>module.exports = { Thing } : { Thing: typeof Thing; } ++>module.exports : { Thing: typeof Thing; } ++>module : { "export=": { Thing: typeof Thing; }; } ++>exports : { Thing: typeof Thing; } + >{ Thing } : { Thing: typeof Thing; } + >Thing : typeof Thing diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff index 076b43195d..b47289a907 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportAssignedVisibility.types.diff @@ -1,32 +1,18 @@ --- old.jsDeclarationsExportAssignedVisibility.types +++ new.jsDeclarationsExportAssignedVisibility.types -@@= skipped -1, +1 lines =@@ - - === index.js === - const Obj = require("./obj"); -->Obj : typeof Obj -->require("./obj") : typeof Obj -+>Obj : any -+>require("./obj") : any - >require : any - >"./obj" : "./obj" - -@@= skipped -10, +10 lines =@@ - +@@= skipped -12, +12 lines =@@ constructor() { this.usage = new Obj(); -->this.usage = new Obj() : Obj -+>this.usage = new Obj() : any - >this.usage : any + >this.usage = new Obj() : Obj +->this.usage : any ++>this.usage : Obj >this : this - >usage : any -->new Obj() : Obj -->Obj : typeof Obj -+>new Obj() : any -+>Obj : any +->usage : any ++>usage : Obj + >new Obj() : Obj + >Obj : typeof Obj } - } - +@@= skipped -11, +11 lines =@@ module.exports = Container; >module.exports = Container : typeof Container >module.exports : typeof Container @@ -35,21 +21,29 @@ >exports : typeof Container >Container : typeof Container --=== obj.js === --module.exports = class Obj { + === obj.js === + module.exports = class Obj { ->module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("obj") ->module.exports : typeof import("obj") ->module : { exports: typeof import("obj"); } ->exports : typeof import("obj") ->class Obj { constructor() { this.x = 12; }} : typeof import("obj") ->Obj : typeof import("obj") -- -- constructor() { -- this.x = 12; -->this.x = 12 : 12 ++>module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("./obj") ++>module.exports : typeof import("./obj") ++>module : { Obj: typeof import("./obj"); } ++>exports : typeof import("./obj") ++>class Obj { constructor() { this.x = 12; }} : typeof import("./obj") ++>Obj : typeof import("./obj") + + constructor() { + this.x = 12; + >this.x = 12 : 12 ->this.x : any -->this : this ++>this.x : number + >this : this ->x : any -->12 : 12 -- } --} \ No newline at end of file ++>x : number + >12 : 12 + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff index 124e7e394d..5413cbe7a4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsExportedClassAliases.types.diff @@ -6,8 +6,8 @@ const errors = require("./errors"); ->errors : typeof errors ->require("./errors") : typeof errors -+>errors : any -+>require("./errors") : any ++>errors : { FancyError: typeof FancyError; } ++>require("./errors") : { FancyError: typeof FancyError; } >require : any >"./errors" : "./errors" @@ -17,44 +17,30 @@ ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->{ errors} : { errors: typeof errors; } -+>module.exports = { errors} : { errors: any; } -+>module.exports : { errors: any; } -+>module : { "export=": { errors: any; }; } -+>exports : { errors: any; } -+>{ errors} : { errors: any; } ++>module.exports = { errors} : { errors: { FancyError: typeof FancyError; }; } ++>module.exports : { errors: { FancyError: typeof FancyError; }; } ++>module : { "export=": { errors: { FancyError: typeof FancyError; }; }; } ++>exports : { errors: { FancyError: typeof FancyError; }; } ++>{ errors} : { errors: { FancyError: typeof FancyError; }; } errors ->errors : typeof errors -- --}; --=== utils/errors.js === --class FancyError extends Error { -->FancyError : FancyError -->Error : Error -- -- constructor(status) { -->status : any -- -- super(`error with status ${status}`); -->super(`error with status ${status}`) : void -->super : ErrorConstructor -->`error with status ${status}` : string -->status : any -- } --} -- --module.exports = { ++>errors : { FancyError: typeof FancyError; } + + }; + === utils/errors.js === +@@= skipped -33, +33 lines =@@ + } + + module.exports = { ->module.exports = { FancyError} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ FancyError} : { FancyError: typeof FancyError; } -- -- FancyError -->FancyError : typeof FancyError -- --}; -- -+>errors : any -+ -+}; \ No newline at end of file ++>module.exports = { FancyError} : { FancyError: typeof FancyError; } ++>module.exports : { FancyError: typeof FancyError; } ++>module : { "export=": { FancyError: typeof FancyError; }; } ++>exports : { FancyError: typeof FancyError; } + >{ FancyError} : { FancyError: typeof FancyError; } + + FancyError \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff index e93da6ef2a..feefca22a3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt.diff @@ -2,12 +2,18 @@ +++ new.jsDeclarationsImportAliasExposedWithinNamespaceCjs.errors.txt @@= skipped -0, +0 lines =@@ - ++file.js(4,11): error TS2315: Type 'Object' is not generic. ++file.js(10,51): error TS2300: Duplicate identifier 'myTypes'. ++file.js(13,13): error TS2300: Duplicate identifier 'myTypes'. ++file.js(18,15): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. ++file.js(18,39): error TS2300: Duplicate identifier 'myTypes'. +file2.js(6,11): error TS2315: Type 'Object' is not generic. ++file2.js(12,23): error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. +file2.js(17,12): error TS2702: 'testFnTypes' only refers to a type, but is being used as a namespace here. +file2.js(28,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== file2.js (3 errors) ==== ++==== file2.js (4 errors) ==== + const {myTypes} = require('./file.js'); + + /** @@ -22,6 +28,8 @@ + }; + + /** @typedef {boolean|myTypes.typeC} testFnTypes.input */ ++ ~~~~~~~ ++!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. + + /** + * @function testFn @@ -42,24 +50,34 @@ + module.exports = {testFn, testFnTypes}; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== file.js (0 errors) ==== ++==== file.js (5 errors) ==== + /** + * @namespace myTypes + * @global + * @type {Object} ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + */ + const myTypes = { + // SOME PROPS HERE + }; + + /** @typedef {string|RegExp|Array} myTypes.typeA */ ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + + /** + * @typedef myTypes.typeB ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + * @property {myTypes.typeA} prop1 - Prop 1. + * @property {string} prop2 - Prop 2. + */ + + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ ++ ~~~~~~~ ++!!! error TS2702: 'myTypes' only refers to a type, but is being used as a namespace here. ++ ~~~~~~~ ++!!! error TS2300: Duplicate identifier 'myTypes'. + + exports.myTypes = myTypes; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff index 11c2853bd6..281a6739e3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsImportAliasExposedWithinNamespaceCjs.types.diff @@ -7,7 +7,7 @@ ->myTypes : { [x: string]: any; } ->require('./file.js') : typeof import("file") +>myTypes : any -+>require('./file.js') : any ++>require('./file.js') : typeof import("./file.js") >require : any >'./file.js' : "./file.js" @@ -55,36 +55,6 @@ ->{testFn, testFnTypes} : { testFn: (input: testFnTypes.input) => number | null; testFnTypes: { [x: string]: any; }; } ->testFn : (input: testFnTypes.input) => number | null ->testFnTypes : { [x: string]: any; } -- --=== file.js === --/** -- * @namespace myTypes -- * @global -- * @type {Object} -- */ --const myTypes = { -->myTypes : { [x: string]: any; } -->{ // SOME PROPS HERE} : {} -- -- // SOME PROPS HERE --}; -- --/** @typedef {string|RegExp|Array} myTypes.typeA */ -- --/** -- * @typedef myTypes.typeB -- * @property {myTypes.typeA} prop1 - Prop 1. -- * @property {string} prop2 - Prop 2. -- */ -- --/** @typedef {myTypes.typeB|Function} myTypes.typeC */ -- --exports.myTypes = myTypes; -->exports.myTypes = myTypes : { [x: string]: any; } -->exports.myTypes : { [x: string]: any; } -->exports : typeof import("file") -->myTypes : { [x: string]: any; } -->myTypes : { [x: string]: any; } +>module.exports = {testFn, testFnTypes} : { testFn: (input: testFnTypes.input) => number; testFnTypes: any; } +>module.exports : { testFn: (input: testFnTypes.input) => number; testFnTypes: any; } +>module : { "export=": { testFn: (input: testFnTypes.input) => number; testFnTypes: any; }; } @@ -92,3 +62,29 @@ +>{testFn, testFnTypes} : { testFn: (input: testFnTypes.input) => number; testFnTypes: any; } +>testFn : (input: testFnTypes.input) => number +>testFnTypes : any + + === file.js === + /** +@@= skipped -15, +15 lines =@@ + * @type {Object} + */ + const myTypes = { +->myTypes : { [x: string]: any; } ++>myTypes : any + >{ // SOME PROPS HERE} : {} + + // SOME PROPS HERE +@@= skipped -17, +17 lines =@@ + /** @typedef {myTypes.typeB|Function} myTypes.typeC */ + + exports.myTypes = myTypes; +->exports.myTypes = myTypes : { [x: string]: any; } +->exports.myTypes : { [x: string]: any; } +->exports : typeof import("file") +->myTypes : { [x: string]: any; } +->myTypes : { [x: string]: any; } ++>exports.myTypes = myTypes : any ++>exports.myTypes : any ++>exports : typeof import("./file") ++>myTypes : any ++>myTypes : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff index 05d602eca0..9aa9eb8797 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReexportedCjsAlias.types.diff @@ -1,17 +1,11 @@ --- old.jsDeclarationsReexportedCjsAlias.types +++ new.jsDeclarationsReexportedCjsAlias.types -@@= skipped -1, +1 lines =@@ - - === main.js === - const { SomeClass, SomeClass: Another } = require('./lib'); -->SomeClass : typeof SomeClass -->SomeClass : any -->Another : typeof SomeClass +@@= skipped -4, +4 lines =@@ + >SomeClass : typeof SomeClass + >SomeClass : any + >Another : typeof SomeClass ->require('./lib') : typeof import("lib") -+>SomeClass : any -+>SomeClass : any -+>Another : any -+>require('./lib') : any ++>require('./lib') : { bar: (a: string) => string; SomeClass: typeof SomeClass; } >require : any >'./lib' : "./lib" @@ -20,56 +14,25 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } -+>module.exports = { SomeClass, Another} : { SomeClass: any; Another: any; } -+>module.exports : { SomeClass: any; Another: any; } -+>module : { "export=": { SomeClass: any; Another: any; }; } -+>exports : { SomeClass: any; Another: any; } -+>{ SomeClass, Another} : { SomeClass: any; Another: any; } ++>module.exports = { SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } ++>module.exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } ++>module : { "export=": { SomeClass: typeof SomeClass; Another: typeof SomeClass; }; } ++>exports : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } + >{ SomeClass, Another} : { SomeClass: typeof SomeClass; Another: typeof SomeClass; } SomeClass, -->SomeClass : typeof SomeClass -+>SomeClass : any +@@= skipped -43, +43 lines =@@ + } - Another -->Another : typeof SomeClass --} --=== lib.js === --/** -- * @param {string} a -- */ --function bar(a) { -->bar : (a: string) => string -->a : string -- -- return a + a; -->a + a : string -->a : string -->a : string --} -- --class SomeClass { -->SomeClass : SomeClass -- -- a() { -->a : () => number -- -- return 1; -->1 : 1 -- } --} -- --module.exports = { + module.exports = { ->module.exports = { bar, SomeClass} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } -- -- bar, -->bar : (a: string) => string -- -- SomeClass -->SomeClass : typeof SomeClass -+>Another : any - } \ No newline at end of file ++>module.exports = { bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } ++>module.exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } ++>module : { "export=": { bar: (a: string) => string; SomeClass: typeof SomeClass; }; } ++>exports : { bar: (a: string) => string; SomeClass: typeof SomeClass; } + >{ bar, SomeClass} : { bar: (a: string) => string; SomeClass: typeof SomeClass; } + + bar, \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt.diff new file mode 100644 index 0000000000..a4400a9598 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt.diff @@ -0,0 +1,50 @@ +--- old.jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt ++++ new.jsDeclarationsReferenceToClassInstanceCrossFile.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(7,19): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++index.js(14,18): error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++ ++ ++==== test.js (0 errors) ==== ++ const {Render} = require("./index"); ++ let render = new Render(); ++ ++ render.addRectangle(); ++ console.log("Objects", render.objects); ++==== rectangle.js (0 errors) ==== ++ class Rectangle { ++ constructor() { ++ console.log("I'm a rectangle!"); ++ } ++ } ++ ++ module.exports = { Rectangle }; ++==== index.js (2 errors) ==== ++ const {Rectangle} = require('./rectangle'); ++ ++ class Render { ++ constructor() { ++ /** ++ * Object list ++ * @type {Rectangle[]} ++ ~~~~~~~~~ ++!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++ */ ++ this.objects = []; ++ } ++ /** ++ * Adds a rectangle ++ * ++ * @returns {Rectangle} the rect ++ ~~~~~~~~~ ++!!! error TS2749: 'Rectangle' refers to a value, but is being used as a type here. Did you mean 'typeof Rectangle'? ++ */ ++ addRectangle() { ++ const obj = new Rectangle(); ++ this.objects.push(obj); ++ return obj; ++ } ++ } ++ ++ module.exports = { Render }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff index d2a09d0ebb..a7a6a40dcd 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsReferenceToClassInstanceCrossFile.types.diff @@ -1,122 +1,74 @@ --- old.jsDeclarationsReferenceToClassInstanceCrossFile.types +++ new.jsDeclarationsReferenceToClassInstanceCrossFile.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === test.js === const {Render} = require("./index"); -->Render : typeof Render + >Render : typeof Render ->require("./index") : typeof import("index") -+>Render : any -+>require("./index") : any ++>require("./index") : { Render: typeof Render; } >require : any >"./index" : "./index" - let render = new Render(); -->render : Render -->new Render() : Render -->Render : typeof Render -+>render : any -+>new Render() : any -+>Render : any +@@= skipped -10, +10 lines =@@ + >Render : typeof Render render.addRectangle(); ->render.addRectangle() : import("rectangle").Rectangle ->render.addRectangle : () => import("rectangle").Rectangle -->render : Render ++>render.addRectangle() : Rectangle ++>render.addRectangle : () => Rectangle + >render : Render ->addRectangle : () => import("rectangle").Rectangle -+>render.addRectangle() : any -+>render.addRectangle : any -+>render : any -+>addRectangle : any ++>addRectangle : () => Rectangle console.log("Objects", render.objects); >console.log("Objects", render.objects) : void -@@= skipped -22, +22 lines =@@ +@@= skipped -11, +11 lines =@@ >console : Console >log : (...data: any[]) => void >"Objects" : "Objects" ->render.objects : import("rectangle").Rectangle[] -->render : Render ++>render.objects : Rectangle[] + >render : Render ->objects : import("rectangle").Rectangle[] -- --=== rectangle.js === --class Rectangle { -->Rectangle : Rectangle -- -- constructor() { -- console.log("I'm a rectangle!"); -->console.log("I'm a rectangle!") : void -->console.log : (...data: any[]) => void -->console : Console -->log : (...data: any[]) => void -->"I'm a rectangle!" : "I'm a rectangle!" -- } --} -- --module.exports = { Rectangle }; ++>objects : Rectangle[] + + === rectangle.js === + class Rectangle { +@@= skipped -19, +19 lines =@@ + } + + module.exports = { Rectangle }; ->module.exports = { Rectangle } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Rectangle } : { Rectangle: typeof Rectangle; } -->Rectangle : typeof Rectangle -- --=== index.js === --const {Rectangle} = require('./rectangle'); -->Rectangle : typeof Rectangle ++>module.exports = { Rectangle } : { Rectangle: typeof Rectangle; } ++>module.exports : { Rectangle: typeof Rectangle; } ++>module : { "export=": { Rectangle: typeof Rectangle; }; } ++>exports : { Rectangle: typeof Rectangle; } + >{ Rectangle } : { Rectangle: typeof Rectangle; } + >Rectangle : typeof Rectangle + + === index.js === + const {Rectangle} = require('./rectangle'); + >Rectangle : typeof Rectangle ->require('./rectangle') : typeof import("rectangle") -->require : any -->'./rectangle' : "./rectangle" -- --class Render { -->Render : Render -- -- constructor() { -- /** -- * Object list -- * @type {Rectangle[]} -- */ -- this.objects = []; -->this.objects = [] : undefined[] -->this.objects : Rectangle[] -->this : this -->objects : Rectangle[] -->[] : undefined[] -- } -- /** -- * Adds a rectangle -- * -- * @returns {Rectangle} the rect -- */ -- addRectangle() { -->addRectangle : () => Rectangle -- -- const obj = new Rectangle(); -->obj : Rectangle -->new Rectangle() : Rectangle -->Rectangle : typeof Rectangle -- -- this.objects.push(obj); -->this.objects.push(obj) : number -->this.objects.push : (...items: Rectangle[]) => number -->this.objects : Rectangle[] -->this : this -->objects : Rectangle[] -->push : (...items: Rectangle[]) => number -->obj : Rectangle -- -- return obj; -->obj : Rectangle -- } --} -- --module.exports = { Render }; ++>require('./rectangle') : { Rectangle: typeof Rectangle; } + >require : any + >'./rectangle' : "./rectangle" + +@@= skipped -57, +57 lines =@@ + } + + module.exports = { Render }; ->module.exports = { Render } : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{ Render } : { Render: typeof Render; } -->Render : typeof Render -+>render.objects : any -+>render : any -+>objects : any ++>module.exports = { Render } : { Render: typeof Render; } ++>module.exports : { Render: typeof Render; } ++>module : { "export=": { Render: typeof Render; }; } ++>exports : { Render: typeof Render; } + >{ Render } : { Render: typeof Render; } + >Render : typeof Render diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff index 67abbae8a5..a95ad05e93 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt.diff @@ -2,13 +2,18 @@ +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.errors.txt @@= skipped -0, +0 lines =@@ - ++index.js(3,37): error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. +index.js(21,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++module.js(24,12): error TS2315: Type 'Object' is not generic. ++module.js(27,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + -+==== index.js (1 errors) ==== ++==== index.js (2 errors) ==== + const {taskGroups, taskNameToGroup} = require('./module.js'); + + /** @typedef {import('./module.js').TaskGroup} TaskGroup */ ++ ~~~~~~~~~ ++!!! error TS2694: Namespace '"module".export=' has no exported member 'TaskGroup'. + + /** + * @typedef TaskNode @@ -29,7 +34,7 @@ + module.exports = MainThreadTasks; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. -+==== module.js (0 errors) ==== ++==== module.js (2 errors) ==== + /** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ + + /** @@ -54,9 +59,16 @@ + } + + /** @type {Object} */ ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2315: Type 'Object' is not generic. + const taskNameToGroup = {}; + + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ + taskGroups, ++ ~~~~~~~~~~~~~~~ + taskNameToGroup, -+ }; \ No newline at end of file ++ ~~~~~~~~~~~~~~~~~~~~ ++ }; ++ ~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff index d9a36ba666..811f187d26 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsDeclarationsTypedefPropertyAndExportAssignment.types.diff @@ -1,19 +1,17 @@ --- old.jsDeclarationsTypedefPropertyAndExportAssignment.types +++ new.jsDeclarationsTypedefPropertyAndExportAssignment.types -@@= skipped -1, +1 lines =@@ - +@@= skipped -2, +2 lines =@@ === index.js === const {taskGroups, taskNameToGroup} = require('./module.js'); -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + >taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } ->taskNameToGroup : { [x: string]: import("module").TaskGroup; } ->require('./module.js') : typeof import("module") -+>taskGroups : any +>taskNameToGroup : any -+>require('./module.js') : any ++>require('./module.js') : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } >require : any >'./module.js' : "./module.js" -@@= skipped -24, +24 lines =@@ +@@= skipped -23, +23 lines =@@ * @param {TaskNode} y */ constructor(x, y){} @@ -30,67 +28,31 @@ >exports : typeof MainThreadTasks >MainThreadTasks : typeof MainThreadTasks --=== module.js === --/** @typedef {'parseHTML'|'styleLayout'} TaskGroupIds */ -- --/** -- * @typedef TaskGroup -- * @property {TaskGroupIds} id -- * @property {string} label -- * @property {string[]} traceEventNames -- */ -- --/** -- * @type {{[P in TaskGroupIds]: {id: P, label: string}}} -- */ --const taskGroups = { -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -->{ parseHTML: { id: 'parseHTML', label: 'Parse HTML & CSS' }, styleLayout: { id: 'styleLayout', label: 'Style & Layout' },} : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -- -- parseHTML: { -->parseHTML : { id: "parseHTML"; label: string; } -->{ id: 'parseHTML', label: 'Parse HTML & CSS' } : { id: "parseHTML"; label: string; } -- -- id: 'parseHTML', -->id : "parseHTML" -->'parseHTML' : "parseHTML" -- -- label: 'Parse HTML & CSS' -->label : string -->'Parse HTML & CSS' : "Parse HTML & CSS" -- -- }, -- styleLayout: { -->styleLayout : { id: "styleLayout"; label: string; } -->{ id: 'styleLayout', label: 'Style & Layout' } : { id: "styleLayout"; label: string; } -- -- id: 'styleLayout', -->id : "styleLayout" -->'styleLayout' : "styleLayout" -- -- label: 'Style & Layout' -->label : string -->'Style & Layout' : "Style & Layout" -- -- }, --} -- --/** @type {Object} */ --const taskNameToGroup = {}; +@@= skipped -58, +58 lines =@@ + + /** @type {Object} */ + const taskNameToGroup = {}; ->taskNameToGroup : { [x: string]: TaskGroup; } -->{} : {} -- --module.exports = { ++>taskNameToGroup : any + >{} : {} + + module.exports = { ->module.exports = { taskGroups, taskNameToGroup,} : typeof module.exports ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: { [x: string]: TaskGroup; }; } -- -- taskGroups, -->taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } -- -- taskNameToGroup, ++>module.exports = { taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>module.exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>module : { "export=": { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; }; } ++>exports : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } ++>{ taskGroups, taskNameToGroup,} : { taskGroups: { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; }; taskNameToGroup: any; } + + taskGroups, + >taskGroups : { parseHTML: { id: "parseHTML"; label: string; }; styleLayout: { id: "styleLayout"; label: string; }; } + + taskNameToGroup, ->taskNameToGroup : { [x: string]: TaskGroup; } -- --}; \ No newline at end of file ++>taskNameToGroup : any + + }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff index 44e0dfe7eb..c70a75cf5f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType.types.diff @@ -1,64 +1,21 @@ --- old.jsdocImportType.types +++ new.jsdocImportType.types -@@= skipped -4, +4 lines =@@ - /** @typedef {import("./mod1")} C - * @type {C} */ - var c; -->c : D -+>c : any - - c.chunk; -->c.chunk : number -->c : D -->chunk : number -+>c.chunk : any -+>c : any -+>chunk : any - - const D = require("./mod1"); -->D : typeof D -->require("./mod1") : typeof D -+>D : any -+>require("./mod1") : any - >require : (name: string) => any - >"./mod1" : "./mod1" - - /** @type {D} */ - var d; -->d : D -+>d : error - - d.chunk; -->d.chunk : number -+>d.chunk : any - >d : D -->chunk : number -+>chunk : any - - === types.d.ts === - declare function require(name: string): any; -@@= skipped -33, +33 lines =@@ - declare var module: { exports: any }; - >module : { exports: any; } - >exports : any -- --=== mod1.js === --/// --class Chunk { -->Chunk : Chunk -- -- constructor() { -- this.chunk = 1; -->this.chunk = 1 : 1 +@@= skipped -46, +46 lines =@@ + constructor() { + this.chunk = 1; + >this.chunk = 1 : 1 ->this.chunk : any -->this : this ++>this.chunk : number + >this : this ->chunk : any -->1 : 1 -- } --} --module.exports = Chunk; -->module.exports = Chunk : typeof Chunk -->module.exports : typeof Chunk ++>chunk : number + >1 : 1 + } + } + module.exports = Chunk; + >module.exports = Chunk : typeof Chunk + >module.exports : typeof Chunk ->module : { exports: typeof Chunk; } -->exports : typeof Chunk -->Chunk : typeof Chunk ++>module : { Chunk: typeof Chunk; } + >exports : typeof Chunk + >Chunk : typeof Chunk diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff index 7d9f2149eb..2146881d0b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocImportType2.types.diff @@ -1,63 +1,30 @@ --- old.jsdocImportType2.types +++ new.jsdocImportType2.types -@@= skipped -4, +4 lines =@@ - /** @typedef {import("./mod1")} C - * @type {C} */ - var c; -->c : D -+>c : any - - c.chunk; -->c.chunk : number -->c : D -->chunk : number -+>c.chunk : any -+>c : any -+>chunk : any - - const D = require("./mod1"); -->D : typeof D -->require("./mod1") : typeof D -+>D : any -+>require("./mod1") : any - >require : (name: string) => any - >"./mod1" : "./mod1" - - /** @type {D} */ - var d; -->d : D -+>d : error - - d.chunk; -->d.chunk : number -+>d.chunk : any - >d : D -->chunk : number -+>chunk : any - - === types.d.ts === - declare function require(name: string): any; -@@= skipped -33, +33 lines =@@ - declare var module: { exports: any }; - >module : { exports: any; } - >exports : any -- --=== mod1.js === --/// --module.exports = class Chunk { +@@= skipped -41, +41 lines =@@ + === mod1.js === + /// + module.exports = class Chunk { ->module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("mod1") ->module.exports : typeof import("mod1") ->module : { exports: typeof import("mod1"); } ->exports : typeof import("mod1") ->class Chunk { constructor() { this.chunk = 1; }} : typeof import("mod1") ->Chunk : typeof import("mod1") -- -- constructor() { -- this.chunk = 1; -->this.chunk = 1 : 1 ++>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") ++>module.exports : typeof import("./mod1") ++>module : { Chunk: typeof import("./mod1"); } ++>exports : typeof import("./mod1") ++>class Chunk { constructor() { this.chunk = 1; }} : typeof import("./mod1") ++>Chunk : typeof import("./mod1") + + constructor() { + this.chunk = 1; + >this.chunk = 1 : 1 ->this.chunk : any -->this : this ++>this.chunk : number + >this : this ->chunk : any -->1 : 1 -- } --} ++>chunk : number + >1 : 1 + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff index fd93dd30cc..f17383b1e4 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.errors.txt.diff @@ -8,25 +8,49 @@ - - -==== use.js (4 errors) ==== -+use.js(1,19): error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. ++mod.js(2,21): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. ++mod.js(2,37): error TS7006: Parameter 'n' implicitly has an 'any' type. ++mod.js(6,35): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. ++mod.js(6,51): error TS7006: Parameter 'mom' implicitly has an 'any' type. ++use.js(3,5): error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. ++use.js(5,5): error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. + + -+==== use.js (1 errors) ==== ++==== use.js (2 errors) ==== var mod = require('./mod'); -+ ~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod'. 'mod.js' implicitly has an 'any' type. mod.f('no') - ~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. mod.g('also no') - ~~~~~~~~~ -!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. ++ ~ ++!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. mod.h(0) - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. mod.i(1) - ~ -!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'. ++ ~ ++!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. - ==== mod.js (0 errors) ==== - /** @param {number} n */ \ No newline at end of file +-==== mod.js (0 errors) ==== ++==== mod.js (4 errors) ==== + /** @param {number} n */ + exports.f = exports.g = function fg(n) { ++ ~ ++!!! error TS2339: Property 'g' does not exist on type 'typeof import("mod")'. ++ ~ ++!!! error TS7006: Parameter 'n' implicitly has an 'any' type. + return n + 1 + } + /** @param {string} mom */ + module.exports.h = module.exports.i = function hi(mom) { ++ ~ ++!!! error TS2339: Property 'i' does not exist on type 'typeof import("mod")'. ++ ~~~ ++!!! error TS7006: Parameter 'mom' implicitly has an 'any' type. + return `hi, ${mom}!`; + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff index aafbc2150b..620d7eacf8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeFromChainedAssignment2.types.diff @@ -1,59 +1,50 @@ --- old.jsdocTypeFromChainedAssignment2.types +++ new.jsdocTypeFromChainedAssignment2.types -@@= skipped -1, +1 lines =@@ - - === use.js === - var mod = require('./mod'); -->mod : typeof mod -->require('./mod') : typeof mod -+>mod : any -+>require('./mod') : any - >require : any +@@= skipped -7, +7 lines =@@ >'./mod' : "./mod" mod.f('no') ->mod.f('no') : number ->mod.f : (n: number) => number -->mod : typeof mod -->f : (n: number) => number +>mod.f('no') : any -+>mod.f : any -+>mod : any -+>f : any ++>mod.f : (n: any) => any + >mod : typeof mod +->f : (n: number) => number ++>f : (n: any) => any >'no' : "no" mod.g('also no') ->mod.g('also no') : number ->mod.g : (n: number) => number -->mod : typeof mod -->g : (n: number) => number +>mod.g('also no') : any +>mod.g : any -+>mod : any + >mod : typeof mod +->g : (n: number) => number +>g : any >'also no' : "also no" mod.h(0) -->mod.h(0) : string + >mod.h(0) : string ->mod.h : (mom: string) => string -->mod : typeof mod ++>mod.h : (mom: any) => string + >mod : typeof mod ->h : (mom: string) => string -+>mod.h(0) : any -+>mod.h : any -+>mod : any -+>h : any ++>h : (mom: any) => string >0 : 0 mod.i(1) ->mod.i(1) : string ->mod.i : (mom: string) => string -->mod : typeof mod ++>mod.i(1) : any ++>mod.i : any + >mod : typeof mod ->i : (mom: string) => string -->1 : 1 -- --=== mod.js === --/** @param {number} n */ --exports.f = exports.g = function fg(n) { ++>i : any + >1 : 1 + + === mod.js === + /** @param {number} n */ + exports.f = exports.g = function fg(n) { ->exports.f = exports.g = function fg(n) { return n + 1} : (n: number) => number ->exports.f : (n: number) => number ->exports : typeof import("mod") @@ -65,14 +56,27 @@ ->function fg(n) { return n + 1} : (n: number) => number ->fg : (n: number) => number ->n : number -- -- return n + 1 ++>exports.f = exports.g = function fg(n) { return n + 1} : (n: any) => any ++>exports.f : (n: any) => any ++>exports : typeof import("./mod") ++>f : (n: any) => any ++>exports.g = function fg(n) { return n + 1} : (n: any) => any ++>exports.g : any ++>exports : typeof import("./mod") ++>g : any ++>function fg(n) { return n + 1} : (n: any) => any ++>fg : (n: any) => any ++>n : any + + return n + 1 ->n + 1 : number ->n : number -->1 : 1 --} --/** @param {string} mom */ --module.exports.h = module.exports.i = function hi(mom) { ++>n + 1 : any ++>n : any + >1 : 1 + } + /** @param {string} mom */ + module.exports.h = module.exports.i = function hi(mom) { ->module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string ->module.exports.h : (mom: string) => string ->module.exports : typeof module.exports @@ -88,13 +92,24 @@ ->function hi(mom) { return `hi, ${mom}!`;} : (mom: string) => string ->hi : (mom: string) => string ->mom : string -- -- return `hi, ${mom}!`; -->`hi, ${mom}!` : string -->mom : string --} -+>mod.i(1) : any -+>mod.i : any -+>mod : any ++>module.exports.h = module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string ++>module.exports.h : (mom: any) => string ++>module.exports : typeof import("./mod") ++>module : { "\"mod\"": typeof import("./mod"); } ++>exports : typeof import("./mod") ++>h : (mom: any) => string ++>module.exports.i = function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string ++>module.exports.i : any ++>module.exports : typeof import("./mod") ++>module : { "\"mod\"": typeof import("./mod"); } ++>exports : typeof import("./mod") +>i : any -+>1 : 1 ++>function hi(mom) { return `hi, ${mom}!`;} : (mom: any) => string ++>hi : (mom: any) => string ++>mom : any + + return `hi, ${mom}!`; + >`hi, ${mom}!` : string +->mom : string ++>mom : any + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff index 9ca705c2ea..9e66ced279 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.errors.txt.diff @@ -3,6 +3,7 @@ @@= skipped -0, +0 lines =@@ - +MC.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== MC.js (1 errors) ==== @@ -22,7 +23,7 @@ + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== MW.js (0 errors) ==== ++==== MW.js (1 errors) ==== + /** @typedef {import("./MC")} MC */ + + class MW { @@ -35,4 +36,6 @@ + } + + module.exports = MW; ++ ~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff index a188cf8a94..23c7215e5f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfClassExpression.types.diff @@ -1,16 +1,6 @@ --- old.jsdocTypeReferenceToImportOfClassExpression.types +++ new.jsdocTypeReferenceToImportOfClassExpression.types -@@= skipped -1, +1 lines =@@ - - === MC.js === - const MW = require("./MW"); -->MW : typeof MW -->require("./MW") : typeof MW -+>MW : any -+>require("./MW") : any - >require : any - >"./MW" : "./MW" - +@@= skipped -9, +9 lines =@@ /** @typedef {number} Cictema */ module.exports = class MC { @@ -28,42 +18,31 @@ +>MC : typeof import("./MC") watch() { -->watch : () => MW -+>watch : () => any - - return new MW(this); -->new MW(this) : MW -->MW : typeof MW -+>new MW(this) : any -+>MW : any - >this : this - } - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : MW -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { + >watch : () => MW +@@= skipped -27, +27 lines =@@ + * @param {MC} compiler the compiler + */ + constructor(compiler) { ->compiler : import("MC") -- -- this.compiler = compiler; ++>compiler : import("./MC") + + this.compiler = compiler; ->this.compiler = compiler : import("MC") ->this.compiler : any -->this : this ++>this.compiler = compiler : import("./MC") ++>this.compiler : import("./MC") + >this : this ->compiler : any ->compiler : import("MC") -- } --} -- --module.exports = MW; -->module.exports = MW : typeof MW -->module.exports : typeof MW ++>compiler : import("./MC") ++>compiler : import("./MC") + } + } + + module.exports = MW; + >module.exports = MW : typeof MW + >module.exports : typeof MW ->module : { exports: typeof MW; } -->exports : typeof MW -->MW : typeof MW ++>module : { MW: typeof MW; } + >exports : typeof MW + >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff index f54eb6f5ba..b9969a5cd3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.errors.txt.diff @@ -3,6 +3,8 @@ @@= skipped -0, +0 lines =@@ - +MC.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++MW.js(1,15): error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? ++MW.js(12,1): error TS2309: An export assignment cannot be used in a module with other exported elements. + + +==== MC.js (1 errors) ==== @@ -23,8 +25,10 @@ + ~ +!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + -+==== MW.js (0 errors) ==== ++==== MW.js (2 errors) ==== + /** @typedef {import("./MC")} MC */ ++ ~~~~~~~~~~~~~~ ++!!! error TS1340: Module './MC' does not refer to a type, but is used as a type here. Did you mean 'typeof import('./MC')'? + + class MW { + /** @@ -36,4 +40,6 @@ + } + + module.exports = MW; ++ ~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff index e93ade3079..78a7b1659f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/jsdocTypeReferenceToImportOfFunctionExpression.types.diff @@ -1,17 +1,6 @@ --- old.jsdocTypeReferenceToImportOfFunctionExpression.types +++ new.jsdocTypeReferenceToImportOfFunctionExpression.types -@@= skipped -1, +1 lines =@@ - - === MC.js === - const MW = require("./MW"); -->MW : typeof MW -->require("./MW") : typeof MW -+>MW : any -+>require("./MW") : any - >require : any - >"./MW" : "./MW" - -@@= skipped -9, +9 lines =@@ +@@= skipped -10, +10 lines =@@ /** @class */ module.exports = function MC() { @@ -21,51 +10,37 @@ ->exports : { (): MW; new (): MC; } ->function MC() { /** @type {any} */ var x = {} return new MW(x);} : typeof MC ->MC : typeof MC -+>module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any -+>module.exports : () => any -+>module : { "export=": () => any; } -+>exports : () => any -+>function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => any -+>MC : () => any ++>module.exports = function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW ++>module.exports : () => MW ++>module : { "export=": () => MW; } ++>exports : () => MW ++>function MC() { /** @type {any} */ var x = {} return new MW(x);} : () => MW ++>MC : () => MW /** @type {any} */ var x = {} -@@= skipped -13, +13 lines =@@ - >{} : {} - - return new MW(x); -->new MW(x) : MW -->MW : typeof MW -+>new MW(x) : any -+>MW : any - >x : any - - }; -- --=== MW.js === --/** @typedef {import("./MC")} MC */ -- --class MW { -->MW : MW -- -- /** -- * @param {MC} compiler the compiler -- */ -- constructor(compiler) { +@@= skipped -29, +29 lines =@@ + * @param {MC} compiler the compiler + */ + constructor(compiler) { ->compiler : { (): MW; new (): MC; } -- -- this.compiler = compiler; ++>compiler : any + + this.compiler = compiler; ->this.compiler = compiler : { (): MW; new (): MC; } -->this.compiler : any -->this : this -->compiler : any ++>this.compiler = compiler : any + >this.compiler : any + >this : this + >compiler : any ->compiler : { (): MW; new (): MC; } -- } --} -- --module.exports = MW; -->module.exports = MW : typeof MW -->module.exports : typeof MW ++>compiler : any + } + } + + module.exports = MW; + >module.exports = MW : typeof MW + >module.exports : typeof MW ->module : { exports: typeof MW; } -->exports : typeof MW -->MW : typeof MW ++>module : { MW: typeof MW; } + >exports : typeof MW + >MW : typeof MW diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt.diff deleted file mode 100644 index 2c86b96c9c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.errors.txt.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.lateBoundAssignmentDeclarationSupport1.errors.txt -+++ new.lateBoundAssignmentDeclarationSupport1.errors.txt -@@= skipped -0, +0 lines =@@ --lateBoundAssignmentDeclarationSupport1.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --lateBoundAssignmentDeclarationSupport1.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. -- -- --==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport1.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport1.js'. 'lateBoundAssignmentDeclarationSupport1.js' implicitly has an 'any' type. - const y = x["my-fake-sym"]; -- ~~~~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - const z = x[x.S]; -- ~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - --==== lateBoundAssignmentDeclarationSupport1.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport1.js (0 errors) ==== - // currently unsupported - const _sym = Symbol(); - const _str = "my-fake-sym"; - - exports[_sym] = "ok"; -- ~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - exports[_str] = "ok"; -- ~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport1")'. - exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff index 45cbf9009c..c48f3cd217 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport1.types.diff @@ -1,63 +1,26 @@ --- old.lateBoundAssignmentDeclarationSupport1.types +++ new.lateBoundAssignmentDeclarationSupport1.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport1.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport1.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport1.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport1.js" : "./lateBoundAssignmentDeclarationSupport1.js" - - const y = x["my-fake-sym"]; - >y : any - >x["my-fake-sym"] : any -->x : typeof x -+>x : any - >"my-fake-sym" : "my-fake-sym" - - const z = x[x.S]; - >z : any - >x[x.S] : any -->x : typeof x -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport1.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --exports[_sym] = "ok"; -->exports[_sym] = "ok" : "ok" -->exports[_sym] : any +@@= skipped -34, +34 lines =@@ + exports[_sym] = "ok"; + >exports[_sym] = "ok" : "ok" + >exports[_sym] : any ->exports : typeof import("lateBoundAssignmentDeclarationSupport1") -->_sym : unique symbol -->"ok" : "ok" -- --exports[_str] = "ok"; -->exports[_str] = "ok" : "ok" -->exports[_str] : any ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") + >_sym : unique symbol + >"ok" : "ok" + + exports[_str] = "ok"; + >exports[_str] = "ok" : "ok" + >exports[_str] : any ->exports : typeof import("lateBoundAssignmentDeclarationSupport1") -->_str : "my-fake-sym" -->"ok" : "ok" -- --exports.S = _sym; -->exports.S = _sym : unique symbol -->exports.S : unique symbol ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") + >_str : "my-fake-sym" + >"ok" : "ok" + + exports.S = _sym; + >exports.S = _sym : unique symbol + >exports.S : unique symbol ->exports : typeof import("lateBoundAssignmentDeclarationSupport1") -->S : unique symbol -->_sym : unique symbol -+>x : any -+>x.S : any -+>x : any -+>S : any ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport1") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff index a2f6ae520e..5df9ea7909 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.errors.txt.diff @@ -5,41 +5,25 @@ - Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. -lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. - Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. --usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. --usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. -- -- --==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport2.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport2.js'. 'lateBoundAssignmentDeclarationSupport2.js' implicitly has an 'any' type. - const y = x["my-fake-sym"]; -- ~~~~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. - const z = x[x.S]; -- ~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. - --==== lateBoundAssignmentDeclarationSupport2.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport2.js (0 errors) ==== - // currently unsupported - const _sym = Symbol(); - const _str = "my-fake-sym"; ++lateBoundAssignmentDeclarationSupport2.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++ Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++ Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. + usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. +@@= skipped -25, +25 lines =@@ module.exports[_sym] = "ok"; -- ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. -!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. ++!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports[_str] = "ok"; -- ~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. -!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2.js")'. ++!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. ++!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport2")'. module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff index 10987101e7..c27c28f17a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport2.types.diff @@ -1,69 +1,38 @@ --- old.lateBoundAssignmentDeclarationSupport2.types +++ new.lateBoundAssignmentDeclarationSupport2.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport2.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport2.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport2.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport2.js" : "./lateBoundAssignmentDeclarationSupport2.js" - - const y = x["my-fake-sym"]; - >y : any - >x["my-fake-sym"] : any -->x : typeof x -+>x : any - >"my-fake-sym" : "my-fake-sym" - - const z = x[x.S]; - >z : any - >x[x.S] : any -->x : typeof x -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport2.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --module.exports[_sym] = "ok"; -->module.exports[_sym] = "ok" : "ok" -->module.exports[_sym] : any +@@= skipped -34, +34 lines =@@ + module.exports[_sym] = "ok"; + >module.exports[_sym] = "ok" : "ok" + >module.exports[_sym] : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_sym : unique symbol -->"ok" : "ok" -- --module.exports[_str] = "ok"; -->module.exports[_str] = "ok" : "ok" -->module.exports[_str] : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") ++>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") + >_sym : unique symbol + >"ok" : "ok" + + module.exports[_str] = "ok"; + >module.exports[_str] = "ok" : "ok" + >module.exports[_str] : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_str : "my-fake-sym" -->"ok" : "ok" -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") ++>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") + >_str : "my-fake-sym" + >"ok" : "ok" + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>x : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport2") ++>module : { "\"lateBoundAssignmentDeclarationSupport2\"": typeof import("./lateBoundAssignmentDeclarationSupport2"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport2") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt.diff deleted file mode 100644 index 044deceeb9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.lateBoundAssignmentDeclarationSupport3.errors.txt -+++ new.lateBoundAssignmentDeclarationSupport3.errors.txt -@@= skipped -0, +0 lines =@@ --usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -- Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. --usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -- Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. -- -- --==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== - const x = require("./lateBoundAssignmentDeclarationSupport3.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport3.js'. 'lateBoundAssignmentDeclarationSupport3.js' implicitly has an 'any' type. - const y = x["my-fake-sym"]; -- ~~~~~~~~~~~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. --!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. - const z = x[x.S]; -- ~~~~~~ --!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. --!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("lateBoundAssignmentDeclarationSupport3")'. - - ==== lateBoundAssignmentDeclarationSupport3.js (0 errors) ==== - // currently unsupported \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff index d731b99fc2..fb61885123 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport3.types.diff @@ -1,77 +1,49 @@ --- old.lateBoundAssignmentDeclarationSupport3.types +++ new.lateBoundAssignmentDeclarationSupport3.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport3.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport3.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport3.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport3.js" : "./lateBoundAssignmentDeclarationSupport3.js" - - const y = x["my-fake-sym"]; - >y : any - >x["my-fake-sym"] : any -->x : typeof x -+>x : any +@@= skipped -32, +32 lines =@@ >"my-fake-sym" : "my-fake-sym" - const z = x[x.S]; - >z : any - >x[x.S] : any -->x : typeof x -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport3.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --Object.defineProperty(module.exports, _sym, { value: "ok" }); + Object.defineProperty(module.exports, _sym, { value: "ok" }); ->Object.defineProperty(module.exports, _sym, { value: "ok" }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, _sym, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_sym : unique symbol -->{ value: "ok" } : { value: string; } -->value : string -->"ok" : "ok" -- --Object.defineProperty(module.exports, _str, { value: "ok" }); ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") ++>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") + >_sym : unique symbol + >{ value: "ok" } : { value: string; } + >value : string + >"ok" : "ok" + + Object.defineProperty(module.exports, _str, { value: "ok" }); ->Object.defineProperty(module.exports, _str, { value: "ok" }) : typeof module.exports -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ++>Object.defineProperty(module.exports, _str, { value: "ok" }) : typeof import("./lateBoundAssignmentDeclarationSupport3") + >Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->_str : "my-fake-sym" -->{ value: "ok" } : { value: string; } -->value : string -->"ok" : "ok" -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") ++>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") + >_str : "my-fake-sym" + >{ value: "ok" } : { value: string; } + >value : string +@@= skipped -28, +28 lines =@@ + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>x : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport3") ++>module : { "\"lateBoundAssignmentDeclarationSupport3\"": typeof import("./lateBoundAssignmentDeclarationSupport3"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport3") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff index 62470a0eee..dd1e65248a 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.errors.txt.diff @@ -12,14 +12,15 @@ - - -==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. ++lateBoundAssignmentDeclarationSupport4.js(9,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport4.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport4.js'. 'lateBoundAssignmentDeclarationSupport4.js' implicitly has an 'any' type. const inst = new x.F(); ++ ~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. @@ -30,13 +31,16 @@ -!!! error TS7053: Property '[_sym]' does not exist on type 'F'. -==== lateBoundAssignmentDeclarationSupport4.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport4.js (0 errors) ==== ++==== lateBoundAssignmentDeclarationSupport4.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; -@@= skipped -30, +19 lines =@@ +@@= skipped -29, +19 lines =@@ + F.prototype[_sym] = "ok"; F.prototype[_str] = "ok"; const inst = new F(); ++ ~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; - ~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff index bcc4219bd4..4b11dd68f3 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport4.types.diff @@ -1,27 +1,18 @@ --- old.lateBoundAssignmentDeclarationSupport4.types +++ new.lateBoundAssignmentDeclarationSupport4.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport4.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport4.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport4.js") : any - >require : any +@@= skipped -7, +7 lines =@@ >"./lateBoundAssignmentDeclarationSupport4.js" : "./lateBoundAssignmentDeclarationSupport4.js" const inst = new x.F(); ->inst : x.F ->new x.F() : x.F ->x.F : typeof x.F -->x : typeof x -->F : typeof x.F +>inst : any +>new x.F() : any -+>x.F : any -+>x : any -+>F : any ++>x.F : () => void + >x : typeof x +->F : typeof x.F ++>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -34,60 +25,59 @@ >z : any >inst[x.S] : any ->inst : x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport4.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>inst : any + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -32, +32 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F.prototype[_sym] = "ok"; -->F.prototype[_sym] = "ok" : "ok" -->F.prototype[_sym] : any -->F.prototype : any ++>F : () => void + } + F.prototype[_sym] = "ok"; + >F.prototype[_sym] = "ok" : "ok" + >F.prototype[_sym] : any + >F.prototype : any ->F : typeof F -->prototype : any -->_sym : unique symbol -->"ok" : "ok" -- --F.prototype[_str] = "ok"; -->F.prototype[_str] = "ok" : "ok" -->F.prototype[_str] : any -->F.prototype : any ++>F : () => void + >prototype : any + >_sym : unique symbol + >"ok" : "ok" +@@= skipped -15, +15 lines =@@ + >F.prototype[_str] = "ok" : "ok" + >F.prototype[_str] : any + >F.prototype : any ->F : typeof F -->prototype : any -->_str : "my-fake-sym" -->"ok" : "ok" -- --const inst = new F(); ++>F : () => void + >prototype : any + >_str : "my-fake-sym" + >"ok" : "ok" + + const inst = new F(); ->inst : F ->new F() : F ->F : typeof F -- --const _y = inst[_str]; -->_y : any -->inst[_str] : any ++>inst : any ++>new F() : any ++>F : () => void + + const _y = inst[_str]; + >_y : any + >inst[_str] : any ->inst : F -->_str : "my-fake-sym" -- --const _z = inst[_sym]; -->_z : any -->inst[_sym] : any ++>inst : any + >_str : "my-fake-sym" + + const _z = inst[_sym]; + >_z : any + >inst[_sym] : any ->inst : F -->_sym : unique symbol -- --module.exports.F = F; ++>inst : any + >_sym : unique symbol + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -95,16 +85,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : () => void ++>module.exports.F : () => void ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") ++>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") ++>F : () => void ++>F : () => void + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>inst : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport4") ++>module : { "\"lateBoundAssignmentDeclarationSupport4\"": typeof import("./lateBoundAssignmentDeclarationSupport4"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport4") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff index d90baf0500..ce391004a9 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.errors.txt.diff @@ -12,14 +12,15 @@ - - -==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. ++lateBoundAssignmentDeclarationSupport5.js(11,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport5.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport5.js'. 'lateBoundAssignmentDeclarationSupport5.js' implicitly has an 'any' type. const inst = new x.F(); ++ ~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. @@ -30,13 +31,16 @@ -!!! error TS7053: Property '[_sym]' does not exist on type 'F'. -==== lateBoundAssignmentDeclarationSupport5.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport5.js (0 errors) ==== ++==== lateBoundAssignmentDeclarationSupport5.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; -@@= skipped -32, +21 lines =@@ +@@= skipped -31, +21 lines =@@ + [_str]: "ok" } const inst = new F(); ++ ~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; - ~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff index 1a36d60671..f7d165b11d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport5.types.diff @@ -1,27 +1,18 @@ --- old.lateBoundAssignmentDeclarationSupport5.types +++ new.lateBoundAssignmentDeclarationSupport5.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport5.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport5.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport5.js") : any - >require : any +@@= skipped -7, +7 lines =@@ >"./lateBoundAssignmentDeclarationSupport5.js" : "./lateBoundAssignmentDeclarationSupport5.js" const inst = new x.F(); ->inst : x.F ->new x.F() : x.F ->x.F : typeof x.F -->x : typeof x -->F : typeof x.F +>inst : any +>new x.F() : any -+>x.F : any -+>x : any -+>F : any ++>x.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + >x : typeof x +->F : typeof x.F ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } const y = inst["my-fake-sym"]; >y : any @@ -34,59 +25,51 @@ >z : any >inst[x.S] : any ->inst : x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport5.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>inst : any + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -32, +32 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F.prototype = { -->F.prototype = { [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } -->F.prototype : { [_sym]: string; "my-fake-sym": string; } ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + } + F.prototype = { + >F.prototype = { [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } + >F.prototype : { [_sym]: string; "my-fake-sym": string; } ->F : typeof F -->prototype : { [_sym]: string; "my-fake-sym": string; } -->{ [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } -- -- [_sym]: "ok", -->[_sym] : string -->_sym : unique symbol -->"ok" : "ok" -- -- [_str]: "ok" -->[_str] : string -->_str : "my-fake-sym" -->"ok" : "ok" --} --const inst = new F(); ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + >prototype : { [_sym]: string; "my-fake-sym": string; } + >{ [_sym]: "ok", [_str]: "ok"} : { [_sym]: string; "my-fake-sym": string; } + +@@= skipped -20, +20 lines =@@ + >"ok" : "ok" + } + const inst = new F(); ->inst : F ->new F() : F ->F : typeof F -- --const _y = inst[_str]; -->_y : any -->inst[_str] : any ++>inst : any ++>new F() : any ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + + const _y = inst[_str]; + >_y : any + >inst[_str] : any ->inst : F -->_str : "my-fake-sym" -- --const _z = inst[_sym]; -->_z : any -->inst[_sym] : any ++>inst : any + >_str : "my-fake-sym" + + const _z = inst[_sym]; + >_z : any + >inst[_sym] : any ->inst : F -->_sym : unique symbol -- --module.exports.F = F; ++>inst : any + >_sym : unique symbol + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -94,16 +77,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } ++>module.exports.F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") ++>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } ++>F : { (): void; prototype: { [_sym]: string; "my-fake-sym": string; }; } + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>inst : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport5") ++>module : { "\"lateBoundAssignmentDeclarationSupport5\"": typeof import("./lateBoundAssignmentDeclarationSupport5"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport5") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff index 0dcd53e959..acc021e6d2 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.errors.txt.diff @@ -12,14 +12,15 @@ - - -==== usage.js (2 errors) ==== -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. ++lateBoundAssignmentDeclarationSupport6.js(10,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. ++usage.js(2,15): error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. + + +==== usage.js (1 errors) ==== const x = require("./lateBoundAssignmentDeclarationSupport6.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport6.js'. 'lateBoundAssignmentDeclarationSupport6.js' implicitly has an 'any' type. const inst = new x.F(); ++ ~~~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const y = inst["my-fake-sym"]; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. @@ -30,13 +31,16 @@ -!!! error TS7053: Property '[_sym]' does not exist on type 'F'. -==== lateBoundAssignmentDeclarationSupport6.js (2 errors) ==== -+==== lateBoundAssignmentDeclarationSupport6.js (0 errors) ==== ++==== lateBoundAssignmentDeclarationSupport6.js (1 errors) ==== // currently unsupported const _sym = Symbol(); const _str = "my-fake-sym"; -@@= skipped -31, +20 lines =@@ +@@= skipped -30, +20 lines =@@ + Object.defineProperty(F.prototype, _str, {value: "ok"}); Object.defineProperty(F.prototype, _sym, {value: "ok"}); const inst = new F(); ++ ~~~~~~~ ++!!! error TS7009: 'new' expression, whose target lacks a construct signature, implicitly has an 'any' type. const _y = inst[_str]; - ~~~~~~~~~~ -!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'F'. diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff index bff7d4f99f..214cb6462d 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport6.types.diff @@ -1,27 +1,18 @@ --- old.lateBoundAssignmentDeclarationSupport6.types +++ new.lateBoundAssignmentDeclarationSupport6.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport6.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport6.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport6.js") : any - >require : any +@@= skipped -7, +7 lines =@@ >"./lateBoundAssignmentDeclarationSupport6.js" : "./lateBoundAssignmentDeclarationSupport6.js" const inst = new x.F(); ->inst : x.F ->new x.F() : x.F ->x.F : typeof x.F -->x : typeof x -->F : typeof x.F +>inst : any +>new x.F() : any -+>x.F : any -+>x : any -+>F : any ++>x.F : () => void + >x : typeof x +->F : typeof x.F ++>F : () => void const y = inst["my-fake-sym"]; >y : any @@ -34,77 +25,70 @@ >z : any >inst[x.S] : any ->inst : x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport6.js === --// currently unsupported --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>inst : any + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -32, +32 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F.prototype.defsAClass = true; -->F.prototype.defsAClass = true : true -->F.prototype.defsAClass : any -->F.prototype : any ++>F : () => void + } + F.prototype.defsAClass = true; + >F.prototype.defsAClass = true : true + >F.prototype.defsAClass : any + >F.prototype : any ->F : typeof F -->prototype : any -->defsAClass : any -->true : true -- --Object.defineProperty(F.prototype, _str, {value: "ok"}); -->Object.defineProperty(F.prototype, _str, {value: "ok"}) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->F.prototype : any ++>F : () => void + >prototype : any + >defsAClass : any + >true : true +@@= skipped -17, +17 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >F.prototype : any ->F : typeof F -->prototype : any -->_str : "my-fake-sym" -->{value: "ok"} : { value: string; } -->value : string -->"ok" : "ok" -- --Object.defineProperty(F.prototype, _sym, {value: "ok"}); -->Object.defineProperty(F.prototype, _sym, {value: "ok"}) : any -->Object.defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->Object : ObjectConstructor -->defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T -->F.prototype : any ++>F : () => void + >prototype : any + >_str : "my-fake-sym" + >{value: "ok"} : { value: string; } +@@= skipped -13, +13 lines =@@ + >Object : ObjectConstructor + >defineProperty : (o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType) => T + >F.prototype : any ->F : typeof F -->prototype : any -->_sym : unique symbol -->{value: "ok"} : { value: string; } -->value : string -->"ok" : "ok" -- --const inst = new F(); ++>F : () => void + >prototype : any + >_sym : unique symbol + >{value: "ok"} : { value: string; } +@@= skipped -8, +8 lines =@@ + >"ok" : "ok" + + const inst = new F(); ->inst : F ->new F() : F ->F : typeof F -- --const _y = inst[_str]; -->_y : any -->inst[_str] : any ++>inst : any ++>new F() : any ++>F : () => void + + const _y = inst[_str]; + >_y : any + >inst[_str] : any ->inst : F -->_str : "my-fake-sym" -- --const _z = inst[_sym]; -->_z : any -->inst[_sym] : any ++>inst : any + >_str : "my-fake-sym" + + const _z = inst[_sym]; + >_z : any + >inst[_sym] : any ->inst : F -->_sym : unique symbol -- --module.exports.F = F; ++>inst : any + >_sym : unique symbol + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -112,16 +96,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : () => void ++>module.exports.F : () => void ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") ++>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") ++>F : () => void ++>F : () => void + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>inst : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport6") ++>module : { "\"lateBoundAssignmentDeclarationSupport6\"": typeof import("./lateBoundAssignmentDeclarationSupport6"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport6") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt.diff deleted file mode 100644 index 27c7b9fd5b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.lateBoundAssignmentDeclarationSupport7.errors.txt -+++ new.lateBoundAssignmentDeclarationSupport7.errors.txt -@@= skipped -0, +0 lines =@@ -- -+usage.js(1,19): error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. -+ -+ -+==== usage.js (1 errors) ==== -+ const x = require("./lateBoundAssignmentDeclarationSupport7.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './lateBoundAssignmentDeclarationSupport7.js'. 'lateBoundAssignmentDeclarationSupport7.js' implicitly has an 'any' type. -+ const y = x.F["my-fake-sym"]; -+ const z = x.F[x.S]; -+ -+==== lateBoundAssignmentDeclarationSupport7.js (0 errors) ==== -+ const _sym = Symbol(); -+ const _str = "my-fake-sym"; -+ -+ function F() { -+ } -+ F[_sym] = "ok"; -+ F[_str] = "ok"; -+ module.exports.F = F; -+ module.exports.S = _sym; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff index c8b83e609d..9d99d6490f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/lateBoundAssignmentDeclarationSupport7.types.diff @@ -1,67 +1,51 @@ --- old.lateBoundAssignmentDeclarationSupport7.types +++ new.lateBoundAssignmentDeclarationSupport7.types -@@= skipped -1, +1 lines =@@ - - === usage.js === - const x = require("./lateBoundAssignmentDeclarationSupport7.js"); -->x : typeof x -->require("./lateBoundAssignmentDeclarationSupport7.js") : typeof x -+>x : any -+>require("./lateBoundAssignmentDeclarationSupport7.js") : any - >require : any - >"./lateBoundAssignmentDeclarationSupport7.js" : "./lateBoundAssignmentDeclarationSupport7.js" - +@@= skipped -9, +9 lines =@@ const y = x.F["my-fake-sym"]; -->y : string -->x.F["my-fake-sym"] : string + >y : string + >x.F["my-fake-sym"] : string ->x.F : typeof x.F -->x : typeof x ++>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } + >x : typeof x ->F : typeof x.F -+>y : any -+>x.F["my-fake-sym"] : any -+>x.F : any -+>x : any -+>F : any ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } >"my-fake-sym" : "my-fake-sym" const z = x.F[x.S]; -->z : string -->x.F[x.S] : string + >z : string + >x.F[x.S] : string ->x.F : typeof x.F -->x : typeof x ++>x.F : { (): void; [_sym]: string; "my-fake-sym": string; } + >x : typeof x ->F : typeof x.F -->x.S : unique symbol -->x : typeof x -->S : unique symbol -- --=== lateBoundAssignmentDeclarationSupport7.js === --const _sym = Symbol(); -->_sym : unique symbol -->Symbol() : unique symbol -->Symbol : SymbolConstructor -- --const _str = "my-fake-sym"; -->_str : "my-fake-sym" -->"my-fake-sym" : "my-fake-sym" -- --function F() { ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + >x.S : unique symbol + >x : typeof x + >S : unique symbol +@@= skipped -26, +26 lines =@@ + >"my-fake-sym" : "my-fake-sym" + + function F() { ->F : typeof F --} --F[_sym] = "ok"; -->F[_sym] = "ok" : "ok" -->F[_sym] : string ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + } + F[_sym] = "ok"; + >F[_sym] = "ok" : "ok" + >F[_sym] : string ->F : typeof F -->_sym : unique symbol -->"ok" : "ok" -- --F[_str] = "ok"; -->F[_str] = "ok" : "ok" -->F[_str] : string ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + >_sym : unique symbol + >"ok" : "ok" + + F[_str] = "ok"; + >F[_str] = "ok" : "ok" + >F[_str] : string ->F : typeof F -->_str : "my-fake-sym" -->"ok" : "ok" -- --module.exports.F = F; ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + >_str : "my-fake-sym" + >"ok" : "ok" + + module.exports.F = F; ->module.exports.F = F : typeof F ->module.exports.F : typeof F ->module.exports : typeof module.exports @@ -69,20 +53,22 @@ ->exports : typeof module.exports ->F : typeof F ->F : typeof F -- --module.exports.S = _sym; -->module.exports.S = _sym : unique symbol -->module.exports.S : unique symbol ++>module.exports.F = F : { (): void; [_sym]: string; "my-fake-sym": string; } ++>module.exports.F : { (): void; [_sym]: string; "my-fake-sym": string; } ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") ++>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } ++>F : { (): void; [_sym]: string; "my-fake-sym": string; } + + module.exports.S = _sym; + >module.exports.S = _sym : unique symbol + >module.exports.S : unique symbol ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->S : unique symbol -->_sym : unique symbol -+>z : any -+>x.F[x.S] : any -+>x.F : any -+>x : any -+>F : any -+>x.S : any -+>x : any -+>S : any ++>module.exports : typeof import("./lateBoundAssignmentDeclarationSupport7") ++>module : { "\"lateBoundAssignmentDeclarationSupport7\"": typeof import("./lateBoundAssignmentDeclarationSupport7"); } ++>exports : typeof import("./lateBoundAssignmentDeclarationSupport7") + >S : unique symbol + >_sym : unique symbol diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.errors.txt.diff new file mode 100644 index 0000000000..9153651bd2 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.moduleExportAlias2.errors.txt ++++ new.moduleExportAlias2.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(4,13): error TS2351: This expression is not constructable. ++ Type 'typeof import("semver")' has no construct signatures. ++semver.js(2,1): error TS2631: Cannot assign to '"semver"' because it is a namespace. ++semver.js(2,11): error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. ++ ++ ++==== index.js (1 errors) ==== ++ /// ++ const C = require("./semver") ++ var two = C.f(1) ++ var c = new C ++ ~ ++!!! error TS2351: This expression is not constructable. ++!!! error TS2351: Type 'typeof import("semver")' has no construct signatures. ++ ++==== node.d.ts (0 errors) ==== ++ declare function require(name: string): any; ++ declare var exports: any; ++ declare var module: { exports: any }; ++==== semver.js (2 errors) ==== ++ /// ++ exports = module.exports = C ++ ~~~~~~~ ++!!! error TS2631: Cannot assign to '"semver"' because it is a namespace. ++ ~~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'typeof import("semver")'. ++ exports.f = n => n + 1 ++ function C() { ++ this.p = 1 ++ } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff index a5e4170584..4784001b51 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAlias2.types.diff @@ -1,44 +1,20 @@ --- old.moduleExportAlias2.types +++ new.moduleExportAlias2.types -@@= skipped -2, +2 lines =@@ - === index.js === - /// - const C = require("./semver") -->C : typeof C -->require("./semver") : typeof C -+>C : any -+>require("./semver") : any - >require : (name: string) => any - >"./semver" : "./semver" - - var two = C.f(1) - >two : any - >C.f(1) : any -->C.f : (n: any) => any -->C : typeof C -->f : (n: any) => any -+>C.f : any -+>C : any -+>f : any +@@= skipped -16, +16 lines =@@ >1 : 1 var c = new C ->c : C ->new C : C -->C : typeof C +>c : any +>new C : any -+>C : any + >C : typeof C === node.d.ts === - declare function require(name: string): any; -@@= skipped -30, +30 lines =@@ - >module : { exports: any; } - >exports : any - --=== semver.js === --/// --exports = module.exports = C +@@= skipped -19, +19 lines =@@ + === semver.js === + /// + exports = module.exports = C ->exports = module.exports = C : typeof C ->exports : typeof C ->module.exports = C : typeof C @@ -46,25 +22,34 @@ ->module : { exports: typeof C; } ->exports : typeof C ->C : typeof C -- --exports.f = n => n + 1 -->exports.f = n => n + 1 : (n: any) => any -->exports.f : (n: any) => any ++>exports = module.exports = C : () => void ++>exports : any ++>module.exports = C : () => void ++>module.exports : typeof import("./semver") ++>module : { "\"semver\"": typeof import("./semver"); } ++>exports : typeof import("./semver") ++>C : () => void + + exports.f = n => n + 1 + >exports.f = n => n + 1 : (n: any) => any + >exports.f : (n: any) => any ->exports : typeof C -->f : (n: any) => any -->n => n + 1 : (n: any) => any -->n : any -->n + 1 : any -->n : any -->1 : 1 -- --function C() { ++>exports : typeof import("./semver") + >f : (n: any) => any + >n => n + 1 : (n: any) => any + >n : any +@@= skipped -20, +20 lines =@@ + >1 : 1 + + function C() { ->C : typeof C -- -- this.p = 1 -->this.p = 1 : 1 -->this.p : any ++>C : () => void + + this.p = 1 + >this.p = 1 : 1 + >this.p : any ->this : this -->p : any -->1 : 1 --} \ No newline at end of file ++>this : any + >p : any + >1 : 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.errors.txt.diff new file mode 100644 index 0000000000..9b02b363c3 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.errors.txt.diff @@ -0,0 +1,48 @@ +--- old.moduleExportAssignment.errors.txt ++++ new.moduleExportAssignment.errors.txt +@@= skipped -0, +0 lines =@@ +- ++npmlog.js(5,14): error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. ++npmlog.js(8,16): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++npmlog.js(10,8): error TS2339: Property 'x' does not exist on type 'EE'. ++npmlog.js(12,8): error TS2339: Property 'y' does not exist on type 'EE'. ++npmlog.js(13,16): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++use.js(2,8): error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++use.js(3,8): error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++ ++ ++==== use.js (2 errors) ==== ++ var npmlog = require('./npmlog') ++ npmlog.x ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++ npmlog.on ++ ~~ ++!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++ ++==== npmlog.js (5 errors) ==== ++ class EE { ++ /** @param {string} s */ ++ on(s) { } ++ } ++ var npmlog = module.exports = new EE() ++ ~~~~~~~~~~~~~~ ++!!! error TS2741: Property 'y' is missing in type 'EE' but required in type 'typeof import("npmlog")'. ++!!! related TS2728 npmlog.js:11:1: 'y' is declared here. ++ ++ npmlog.on('hi') // both references should see EE.on ++ module.exports.on('hi') // here too ++ ~~ ++!!! error TS2339: Property 'on' does not exist on type 'typeof import("npmlog")'. ++ ++ npmlog.x = 1 ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'EE'. ++ module.exports.y = 2 ++ npmlog.y ++ ~ ++!!! error TS2339: Property 'y' does not exist on type 'EE'. ++ module.exports.x ++ ~ ++!!! error TS2339: Property 'x' does not exist on type 'typeof import("npmlog")'. ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff index d43b301909..2518a28793 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment.types.diff @@ -6,8 +6,8 @@ var npmlog = require('./npmlog') ->npmlog : { on(s: string): void; x: number; y: 2; } ->require('./npmlog') : { on(s: string): void; x: number; y: 2; } -+>npmlog : any -+>require('./npmlog') : any ++>npmlog : typeof npmlog ++>require('./npmlog') : typeof npmlog >require : any >'./npmlog' : "./npmlog" @@ -16,75 +16,97 @@ ->npmlog : { on(s: string): void; x: number; y: 2; } ->x : number +>npmlog.x : any -+>npmlog : any ++>npmlog : typeof npmlog +>x : any npmlog.on ->npmlog.on : (s: string) => void ->npmlog : { on(s: string): void; x: number; y: 2; } ->on : (s: string) => void -- --=== npmlog.js === --class EE { -->EE : EE -- -- /** @param {string} s */ -- on(s) { } -->on : (s: string) => void -->s : string --} --var npmlog = module.exports = new EE() ++>npmlog.on : any ++>npmlog : typeof npmlog ++>on : any + + === npmlog.js === + class EE { +@@= skipped -25, +25 lines =@@ + >s : string + } + var npmlog = module.exports = new EE() ->npmlog : { on(s: string): void; x: number; y: 2; } ->module.exports = new EE() : { on(s: string): void; x: number; y: 2; } ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } -->new EE() : EE -->EE : typeof EE -- --npmlog.on('hi') // both references should see EE.on -->npmlog.on('hi') : void -->npmlog.on : (s: string) => void ++>npmlog : EE ++>module.exports = new EE() : EE ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") + >new EE() : EE + >EE : typeof EE + + npmlog.on('hi') // both references should see EE.on + >npmlog.on('hi') : void + >npmlog.on : (s: string) => void ->npmlog : { on(s: string): void; x: number; y: 2; } -->on : (s: string) => void -->'hi' : "hi" -- --module.exports.on('hi') // here too ++>npmlog : EE + >on : (s: string) => void + >'hi' : "hi" + + module.exports.on('hi') // here too ->module.exports.on('hi') : void ->module.exports.on : (s: string) => void ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } ->on : (s: string) => void -->'hi' : "hi" -- --npmlog.x = 1 -->npmlog.x = 1 : 1 ++>module.exports.on('hi') : any ++>module.exports.on : any ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") ++>on : any + >'hi' : "hi" + + npmlog.x = 1 + >npmlog.x = 1 : 1 ->npmlog.x : number ->npmlog : { on(s: string): void; x: number; y: 2; } ->x : number -->1 : 1 -- --module.exports.y = 2 -->module.exports.y = 2 : 2 -->module.exports.y : 2 ++>npmlog.x : any ++>npmlog : EE ++>x : any + >1 : 1 + + module.exports.y = 2 + >module.exports.y = 2 : 2 + >module.exports.y : 2 ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } -->y : 2 -->2 : 2 -- --npmlog.y ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") + >y : 2 + >2 : 2 + + npmlog.y ->npmlog.y : 2 ->npmlog : { on(s: string): void; x: number; y: 2; } ->y : 2 -- --module.exports.x ++>npmlog.y : any ++>npmlog : EE ++>y : any + + module.exports.x ->module.exports.x : number ->module.exports : { on(s: string): void; x: number; y: 2; } ->module : { exports: { on(s: string): void; x: number; y: 2; }; } ->exports : { on(s: string): void; x: number; y: 2; } ->x : number -+>npmlog.on : any -+>npmlog : any -+>on : any ++>module.exports.x : any ++>module.exports : typeof import("./npmlog") ++>module : { "\"npmlog\"": typeof import("./npmlog"); } ++>exports : typeof import("./npmlog") ++>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff index cb4bd5968a..e0a756302f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportAssignment3.types.diff @@ -1,33 +1,18 @@ --- old.moduleExportAssignment3.types +++ new.moduleExportAssignment3.types -@@= skipped -1, +1 lines =@@ - - === npm.js === - var mod = require('./mod') -->mod : () => void -->require('./mod') : () => void -+>mod : any -+>require('./mod') : any - >require : any - >'./mod' : "./mod" - - mod() // should be callable from here too -->mod() : void -->mod : () => void -- --=== mod.js === --module.exports = function x() { } -->module.exports = function x() { } : () => void -->module.exports : () => void +@@= skipped -14, +14 lines =@@ + module.exports = function x() { } + >module.exports = function x() { } : () => void + >module.exports : () => void ->module : { exports: () => void; } -->exports : () => void -->function x() { } : () => void -->x : () => void -- --module.exports() // should be callable -->module.exports() : void -->module.exports : () => void ++>module : { "export=": () => void; } + >exports : () => void + >function x() { } : () => void + >x : () => void +@@= skipped -8, +8 lines =@@ + module.exports() // should be callable + >module.exports() : void + >module.exports : () => void ->module : { exports: () => void; } -->exports : () => void -+>mod() : any -+>mod : any ++>module : { "export=": () => void; } + >exports : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff index b450df1f67..ca6d1709ce 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.errors.txt.diff @@ -1,26 +1,38 @@ --- old.moduleExportDuplicateAlias.errors.txt +++ new.moduleExportDuplicateAlias.errors.txt @@= skipped -0, +0 lines =@@ --moduleExportAliasDuplicateAlias.js(3,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. + moduleExportAliasDuplicateAlias.js(3,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. - - -==== test.js (0 errors) ==== -+test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. + + +==== test.js (1 errors) ==== const { apply } = require('./moduleExportAliasDuplicateAlias') -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. apply() ++ ~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. -==== moduleExportAliasDuplicateAlias.js (1 errors) ==== -+==== moduleExportAliasDuplicateAlias.js (0 errors) ==== ++==== moduleExportAliasDuplicateAlias.js (5 errors) ==== exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. function a() { } exports.apply() -- ~~~~~~~~~~~~~ --!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + ~~~~~~~~~~~~~ + !!! error TS2722: Cannot invoke an object which is possibly 'undefined'. exports.apply = a; ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. exports.apply() ++ ~~~~~~~~~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff index 2e28c658f8..f25149178b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias.types.diff @@ -6,43 +6,53 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : () => void ->require('./moduleExportAliasDuplicateAlias') : typeof import("moduleExportAliasDuplicateAlias") -+>apply : any -+>require('./moduleExportAliasDuplicateAlias') : any ++>apply : undefined ++>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() ->apply() : void ->apply : () => void -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply = undefined : undefined ++>apply() : any ++>apply : undefined + + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply = undefined : undefined ->exports.apply : any ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : any -->undefined : undefined -- --function a() { } -->a : () => void -- --exports.apply() -->exports.apply() : any -->exports.apply : undefined ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + function a() { } +@@= skipped -23, +23 lines =@@ + exports.apply() + >exports.apply() : any + >exports.apply : undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") -->apply : undefined -- --exports.apply = a; -->exports.apply = a : () => void ++>exports : typeof import("./moduleExportAliasDuplicateAlias") + >apply : undefined + + exports.apply = a; + >exports.apply = a : () => void ->exports.apply : any ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : any -->a : () => void -- --exports.apply() ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + exports.apply() ->exports.apply() : void ->exports.apply : () => void ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : () => void -+>apply() : any -+>apply : any ++>exports.apply() : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff index f201ad418a..fc0269d365 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.errors.txt.diff @@ -2,19 +2,37 @@ +++ new.moduleExportDuplicateAlias2.errors.txt @@= skipped -0, +0 lines =@@ - -+test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. ++moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(3,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(3,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++test.js(2,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. + + +==== test.js (1 errors) ==== + const { apply } = require('./moduleExportAliasDuplicateAlias') -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. + apply() ++ ~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + -+==== moduleExportAliasDuplicateAlias.js (0 errors) ==== ++==== moduleExportAliasDuplicateAlias.js (6 errors) ==== + module.exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + function a() { } + module.exports.apply = a; ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + module.exports.apply = a; ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + module.exports.apply() ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff index 1cac7d593f..537ce0e91b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias2.types.diff @@ -6,52 +6,73 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : () => void ->require('./moduleExportAliasDuplicateAlias') : typeof import("moduleExportAliasDuplicateAlias") -+>apply : any -+>require('./moduleExportAliasDuplicateAlias') : any ++>apply : undefined ++>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" apply() ->apply() : void ->apply : () => void -- --=== moduleExportAliasDuplicateAlias.js === --module.exports.apply = undefined; -->module.exports.apply = undefined : undefined ++>apply() : any ++>apply : undefined + + === moduleExportAliasDuplicateAlias.js === + module.exports.apply = undefined; + >module.exports.apply = undefined : undefined ->module.exports.apply : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : any -->undefined : undefined -- --function a() { } -->a : () => void -- --module.exports.apply = a; -->module.exports.apply = a : () => void ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + function a() { } +@@= skipped -24, +24 lines =@@ + + module.exports.apply = a; + >module.exports.apply = a : () => void ->module.exports.apply : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : any -->a : () => void -- --module.exports.apply = a; -->module.exports.apply = a : () => void ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + module.exports.apply = a; + >module.exports.apply = a : () => void ->module.exports.apply : any ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : any -->a : () => void -- --module.exports.apply() ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + module.exports.apply() ->module.exports.apply() : void ->module.exports.apply : () => void ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports ->apply : () => void -+>apply() : any -+>apply : any ++>module.exports.apply() : any ++>module.exports.apply : undefined ++>module.exports : typeof import("./moduleExportAliasDuplicateAlias") ++>module : { "\"moduleExportAliasDuplicateAlias\"": typeof import("./moduleExportAliasDuplicateAlias"); } ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff index 2ef6951e1a..1a3b4d0e59 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.errors.txt.diff @@ -2,22 +2,52 @@ +++ new.moduleExportDuplicateAlias3.errors.txt @@= skipped -0, +0 lines =@@ - -+test.js(1,27): error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. ++moduleExportAliasDuplicateAlias.js(1,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(2,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2322: Type '() => void' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(4,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(5,1): error TS2722: Cannot invoke an object which is possibly 'undefined'. ++moduleExportAliasDuplicateAlias.js(6,1): error TS2322: Type '"ok"' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(6,1): error TS2323: Cannot redeclare exported variable 'apply'. ++moduleExportAliasDuplicateAlias.js(7,10): error TS18048: 'exports.apply' is possibly 'undefined'. ++moduleExportAliasDuplicateAlias.js(8,1): error TS2322: Type '1' is not assignable to type 'undefined'. ++moduleExportAliasDuplicateAlias.js(8,1): error TS2323: Cannot redeclare exported variable 'apply'. ++test.js(2,16): error TS18048: 'apply' is possibly 'undefined'. + + +==== test.js (1 errors) ==== + const { apply } = require('./moduleExportAliasDuplicateAlias') -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './moduleExportAliasDuplicateAlias'. 'moduleExportAliasDuplicateAlias.js' implicitly has an 'any' type. + const result = apply.toFixed() ++ ~~~~~ ++!!! error TS18048: 'apply' is possibly 'undefined'. + -+==== moduleExportAliasDuplicateAlias.js (0 errors) ==== ++==== moduleExportAliasDuplicateAlias.js (10 errors) ==== + exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + exports.apply = undefined; ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + function a() { } + exports.apply = a; ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '() => void' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + exports.apply() ++ ~~~~~~~~~~~~~ ++!!! error TS2722: Cannot invoke an object which is possibly 'undefined'. + exports.apply = 'ok' ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '"ok"' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + var OK = exports.apply.toUpperCase() ++ ~~~~~~~~~~~~~ ++!!! error TS18048: 'exports.apply' is possibly 'undefined'. + exports.apply = 1 ++ ~~~~~~~~~~~~~ ++!!! error TS2322: Type '1' is not assignable to type 'undefined'. ++ ~~~~~~~~~~~~~~~~~ ++!!! error TS2323: Cannot redeclare exported variable 'apply'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff index 5202272a64..eaf355aace 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportDuplicateAlias3.types.diff @@ -6,8 +6,8 @@ const { apply } = require('./moduleExportAliasDuplicateAlias') ->apply : number ->require('./moduleExportAliasDuplicateAlias') : typeof import("moduleExportAliasDuplicateAlias") -+>apply : any -+>require('./moduleExportAliasDuplicateAlias') : any ++>apply : undefined ++>require('./moduleExportAliasDuplicateAlias') : typeof import("./moduleExportAliasDuplicateAlias") >require : any >'./moduleExportAliasDuplicateAlias' : "./moduleExportAliasDuplicateAlias" @@ -17,46 +17,67 @@ ->apply.toFixed : (fractionDigits?: number) => string ->apply : number ->toFixed : (fractionDigits?: number) => string -- --=== moduleExportAliasDuplicateAlias.js === --exports.apply = undefined; -->exports.apply = undefined : undefined ++>result : any ++>apply.toFixed() : any ++>apply.toFixed : any ++>apply : undefined ++>toFixed : any + + === moduleExportAliasDuplicateAlias.js === + exports.apply = undefined; + >exports.apply = undefined : undefined ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->undefined : undefined -- --exports.apply = undefined; -->exports.apply = undefined : undefined ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + exports.apply = undefined; + >exports.apply = undefined : undefined ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->undefined : undefined -- --function a() { } -->a : () => void -- --exports.apply = a; -->exports.apply = a : () => void ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >undefined : undefined + + function a() { } +@@= skipped -32, +32 lines =@@ + + exports.apply = a; + >exports.apply = a : () => void ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->a : () => void -- --exports.apply() ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >a : () => void + + exports.apply() ->exports.apply() : void ->exports.apply : () => void ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : () => void -- --exports.apply = 'ok' -->exports.apply = 'ok' : "ok" ++>exports.apply() : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + + exports.apply = 'ok' + >exports.apply = 'ok' : "ok" ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->'ok' : "ok" -- --var OK = exports.apply.toUpperCase() ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >'ok' : "ok" + + var OK = exports.apply.toUpperCase() ->OK : string ->exports.apply.toUpperCase() : string ->exports.apply.toUpperCase : () => string @@ -64,15 +85,20 @@ ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" ->toUpperCase : () => string -- --exports.apply = 1 -->exports.apply = 1 : 1 ++>OK : any ++>exports.apply.toUpperCase() : any ++>exports.apply.toUpperCase : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined ++>toUpperCase : any + + exports.apply = 1 + >exports.apply = 1 : 1 ->exports.apply : "ok" | 1 | (() => void) | undefined ->exports : typeof import("moduleExportAliasDuplicateAlias") ->apply : "ok" | 1 | (() => void) | undefined -->1 : 1 -+>result : any -+>apply.toFixed() : any -+>apply.toFixed : any -+>apply : any -+>toFixed : any ++>exports.apply : undefined ++>exports : typeof import("./moduleExportAliasDuplicateAlias") ++>apply : undefined + >1 : 1 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff index 6759eb7325..78ce2117dc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.errors.txt.diff @@ -2,24 +2,31 @@ +++ new.moduleExportWithExportPropertyAssignment.errors.txt @@= skipped -0, +0 lines =@@ -a.js(4,6): error TS2554: Expected 1 arguments, but got 0. -- -- --==== a.js (1 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1() -- mod1.f() // error, not enough arguments -- ~ ++a.js(4,6): error TS2339: Property 'f' does not exist on type '() => void'. ++mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(4,16): error TS2339: Property 'f' does not exist on type '() => void'. + + + ==== a.js (1 errors) ==== +@@= skipped -6, +8 lines =@@ + mod1() + mod1.f() // error, not enough arguments + ~ -!!! error TS2554: Expected 1 arguments, but got 0. -!!! related TS6210 mod1.js:4:30: An argument for 'a' was not provided. -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; ++!!! error TS2339: Property 'f' does not exist on type '() => void'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; -==== mod1.js (0 errors) ==== -- /// -- module.exports = function () { } -- /** @param {number} a */ -- module.exports.f = function (a) { } -- -+ \ No newline at end of file ++==== mod1.js (2 errors) ==== + /// + module.exports = function () { } ++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + /** @param {number} a */ + module.exports.f = function (a) { } ++ ~ ++!!! error TS2339: Property 'f' does not exist on type '() => void'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff index 663416a6e5..7179afaef8 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment.types.diff @@ -6,16 +6,15 @@ var mod1 = require('./mod1') ->mod1 : { (): void; f: (a: number) => void; } ->require('./mod1') : { (): void; f: (a: number) => void; } -+>mod1 : any -+>require('./mod1') : any ++>mod1 : () => void ++>require('./mod1') : () => void >require : (name: string) => any >'./mod1' : "./mod1" mod1() -->mod1() : void + >mod1() : void ->mod1 : { (): void; f: (a: number) => void; } -+>mod1() : any -+>mod1 : any ++>mod1 : () => void mod1.f() // error, not enough arguments ->mod1.f() : void @@ -24,27 +23,27 @@ ->f : (a: number) => void +>mod1.f() : any +>mod1.f : any -+>mod1 : any ++>mod1 : () => void +>f : any === requires.d.ts === declare var module: { exports: any }; -@@= skipped -23, +23 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports = function () { } +@@= skipped -27, +27 lines =@@ + === mod1.js === + /// + module.exports = function () { } ->module.exports = function () { } : { (): void; f: (a: number) => void; } ->module.exports : { (): void; f: (a: number) => void; } ->module : { exports: { (): void; f: (a: number) => void; }; } ->exports : { (): void; f: (a: number) => void; } -->function () { } : () => void -- --/** @param {number} a */ --module.exports.f = function (a) { } ++>module.exports = function () { } : () => void ++>module.exports : () => void ++>module : { "export=": () => void; } ++>exports : () => void + >function () { } : () => void + + /** @param {number} a */ + module.exports.f = function (a) { } ->module.exports.f = function (a) { } : (a: number) => void ->module.exports.f : (a: number) => void ->module.exports : { (): void; f: (a: number) => void; } @@ -53,3 +52,11 @@ ->f : (a: number) => void ->function (a) { } : (a: number) => void ->a : number ++>module.exports.f = function (a) { } : (a: any) => void ++>module.exports.f : any ++>module.exports : () => void ++>module : { "export=": () => void; } ++>exports : () => void ++>f : any ++>function (a) { } : (a: any) => void ++>a : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff index d0388eecad..fe3efec848 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.errors.txt.diff @@ -3,24 +3,30 @@ @@= skipped -0, +0 lines =@@ -a.js(4,6): error TS2339: Property 'f' does not exist on type 'number'. -mod1.js(3,16): error TS2339: Property 'f' does not exist on type 'number'. -- -- --==== a.js (1 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1.toFixed(12) -- mod1.f() // error, 'f' is not a property on 'number' -- ~ ++a.js(4,6): error TS2339: Property 'f' does not exist on type '1'. ++mod1.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(3,16): error TS2339: Property 'f' does not exist on type '1'. + + + ==== a.js (1 errors) ==== +@@= skipped -7, +8 lines =@@ + mod1.toFixed(12) + mod1.f() // error, 'f' is not a property on 'number' + ~ -!!! error TS2339: Property 'f' does not exist on type 'number'. -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; ++!!! error TS2339: Property 'f' does not exist on type '1'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; -==== mod1.js (1 errors) ==== -- /// -- module.exports = 1 -- module.exports.f = function () { } -- ~ ++==== mod1.js (2 errors) ==== + /// + module.exports = 1 ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.f = function () { } + ~ -!!! error TS2339: Property 'f' does not exist on type 'number'. -- -+ \ No newline at end of file ++!!! error TS2339: Property 'f' does not exist on type '1'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff index e2f347adbe..9bbc38b930 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment2.types.diff @@ -6,49 +6,49 @@ var mod1 = require('./mod1') ->mod1 : number ->require('./mod1') : number -+>mod1 : any -+>require('./mod1') : any ++>mod1 : 1 ++>require('./mod1') : 1 >require : (name: string) => any >'./mod1' : "./mod1" mod1.toFixed(12) -->mod1.toFixed(12) : string -->mod1.toFixed : (fractionDigits?: number) => string + >mod1.toFixed(12) : string + >mod1.toFixed : (fractionDigits?: number) => string ->mod1 : number -->toFixed : (fractionDigits?: number) => string -+>mod1.toFixed(12) : any -+>mod1.toFixed : any -+>mod1 : any -+>toFixed : any ++>mod1 : 1 + >toFixed : (fractionDigits?: number) => string >12 : 12 mod1.f() // error, 'f' is not a property on 'number' >mod1.f() : any >mod1.f : any ->mod1 : number -+>mod1 : any ++>mod1 : 1 >f : any === requires.d.ts === -@@= skipped -26, +26 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports = 1 +@@= skipped -30, +30 lines =@@ + === mod1.js === + /// + module.exports = 1 ->module.exports = 1 : number ->module.exports : number ->module : { exports: number; } ->exports : number -->1 : 1 -- --module.exports.f = function () { } -->module.exports.f = function () { } : () => void -->module.exports.f : any ++>module.exports = 1 : 1 ++>module.exports : 1 ++>module : { "export=": 1; } ++>exports : 1 + >1 : 1 + + module.exports.f = function () { } + >module.exports.f = function () { } : () => void + >module.exports.f : any ->module.exports : number ->module : { exports: number; } ->exports : number -->f : any -->function () { } : () => void ++>module.exports : 1 ++>module : { "export=": 1; } ++>exports : 1 + >f : any + >function () { } : () => void diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff index 3a74bd677f..6982a01c04 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.errors.txt.diff @@ -8,31 +8,53 @@ - - -==== a.js (2 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1.justExport.toFixed() -- mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' ++a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. ++mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(8,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(9,16): error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. ++ ++ ++==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' + mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.justProperty.length -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; + mod1.justProperty.length ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; + declare function require(name: string): any; -==== mod1.js (0 errors) ==== -- /// -- module.exports.bothBefore = 'string' -- module.exports = { -- justExport: 1, -- bothBefore: 2, -- bothAfter: 3, -- } -- module.exports.bothAfter = 'string' -- module.exports.justProperty = 'string' -- -+ \ No newline at end of file ++==== mod1.js (4 errors) ==== + /// + module.exports.bothBefore = 'string' ++ ~~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ + justExport: 1, ++ ~~~~~~~~~~~~~~~~~~ + bothBefore: 2, ++ ~~~~~~~~~~~~~~~~~~ + bothAfter: 3, ++ ~~~~~~~~~~~~~~~~~ + } ++ ~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + module.exports.bothAfter = 'string' ++ ~~~~~~~~~~~~~~~~~~~~~~~~ ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff index 947afb30b8..2db4d6cc09 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment3.types.diff @@ -6,46 +6,47 @@ var mod1 = require('./mod1') ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->require('./mod1') : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } -+>mod1 : any -+>require('./mod1') : any ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } ++>require('./mod1') : { justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" - mod1.justExport.toFixed() -->mod1.justExport.toFixed() : string -->mod1.justExport.toFixed : (fractionDigits?: number) => string -->mod1.justExport : number +@@= skipped -9, +9 lines =@@ + >mod1.justExport.toFixed() : string + >mod1.justExport.toFixed : (fractionDigits?: number) => string + >mod1.justExport : number ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } -->justExport : number -->toFixed : (fractionDigits?: number) => string -+>mod1.justExport.toFixed() : any -+>mod1.justExport.toFixed : any -+>mod1.justExport : any -+>mod1 : any -+>justExport : any -+>toFixed : any ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } + >justExport : number + >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error, 'toFixed' not on 'string | number' - >mod1.bothBefore.toFixed() : any - >mod1.bothBefore.toFixed : any +->mod1.bothBefore.toFixed() : any +->mod1.bothBefore.toFixed : any ->mod1.bothBefore : number | "string" ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothBefore : number | "string" -+>mod1.bothBefore : any -+>mod1 : any -+>bothBefore : any - >toFixed : any +->toFixed : any ++>mod1.bothBefore.toFixed() : string ++>mod1.bothBefore.toFixed : (fractionDigits?: number) => string ++>mod1.bothBefore : number ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number ++>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() // error, 'toFixed' not on 'string | number' - >mod1.bothAfter.toFixed() : any - >mod1.bothAfter.toFixed : any +->mod1.bothAfter.toFixed() : any +->mod1.bothAfter.toFixed : any ->mod1.bothAfter : number | "string" ->mod1 : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothAfter : number | "string" -+>mod1.bothAfter : any -+>mod1 : any -+>bothAfter : any - >toFixed : any +->toFixed : any ++>mod1.bothAfter.toFixed() : string ++>mod1.bothAfter.toFixed : (fractionDigits?: number) => string ++>mod1.bothAfter : number ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number ++>toFixed : (fractionDigits?: number) => string mod1.justProperty.length ->mod1.justProperty.length : number @@ -55,61 +56,66 @@ ->length : number +>mod1.justProperty.length : any +>mod1.justProperty : any -+>mod1 : any ++>mod1 : { justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>length : any === requires.d.ts === declare var module: { exports: any }; -@@= skipped -44, +44 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' -->module.exports.bothBefore = 'string' : "string" +@@= skipped -40, +40 lines =@@ + /// + module.exports.bothBefore = 'string' + >module.exports.bothBefore = 'string' : "string" ->module.exports.bothBefore : number | "string" ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothBefore : number | "string" -->'string' : "string" -- --module.exports = { ++>module.exports.bothBefore : number ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number + >'string' : "string" + + module.exports = { ->module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } -->{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } -- -- justExport: 1, -->justExport : number -->1 : 1 -- -- bothBefore: 2, -->bothBefore : number -->2 : 2 -- -- bothAfter: 3, -->bothAfter : number -->3 : 3 --} --module.exports.bothAfter = 'string' -->module.exports.bothAfter = 'string' : "string" ++>module.exports = { justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } + >{ justExport: 1, bothBefore: 2, bothAfter: 3,} : { justExport: number; bothBefore: number; bothAfter: number; } + + justExport: 1, +@@= skipped -28, +28 lines =@@ + } + module.exports.bothAfter = 'string' + >module.exports.bothAfter = 'string' : "string" ->module.exports.bothAfter : number | "string" ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->bothAfter : number | "string" -->'string' : "string" -- --module.exports.justProperty = 'string' -->module.exports.justProperty = 'string' : "string" ++>module.exports.bothAfter : number ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number + >'string' : "string" + + module.exports.justProperty = 'string' + >module.exports.justProperty = 'string' : "string" ->module.exports.justProperty : "string" ->module.exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->module : { exports: { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; }; } ->exports : { justExport: number; bothBefore: number | "string"; bothAfter: number | "string"; justProperty: "string"; } ->justProperty : "string" -->'string' : "string" ++>module.exports.justProperty : any ++>module.exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>module : { "export=": { justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { justExport: number; bothBefore: number; bothAfter: number; } ++>justProperty : any + >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff index 361827ad25..57078c0343 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.errors.txt.diff @@ -12,41 +12,55 @@ - - -==== a.js (2 errors) ==== -- /// -- var mod1 = require('./mod1') -- mod1.justExport.toFixed() -- mod1.bothBefore.toFixed() // error ++a.js(6,6): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ++mod1.js(2,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(10,1): error TS2322: Type 'string' is not assignable to type 'number'. ++mod1.js(11,16): error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. ++ ++ ++==== a.js (1 errors) ==== + /// + var mod1 = require('./mod1') + mod1.justExport.toFixed() + mod1.bothBefore.toFixed() // error - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.bothAfter.toFixed() + mod1.bothAfter.toFixed() - ~~~~~~~ -!!! error TS2339: Property 'toFixed' does not exist on type 'number | "string"'. -!!! error TS2339: Property 'toFixed' does not exist on type '"string"'. -- mod1.justProperty.length -- --==== requires.d.ts (0 errors) ==== -- declare var module: { exports: any }; -- declare function require(name: string): any; --==== mod1.js (4 errors) ==== -- /// -- module.exports.bothBefore = 'string' -- ~~~~~~~~~~~~~~~~~~~~~~~~~ + mod1.justProperty.length ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + + ==== requires.d.ts (0 errors) ==== + declare var module: { exports: any }; +@@= skipped -28, +21 lines =@@ + /// + module.exports.bothBefore = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothBefore'. -- A.justExport = 4 -- A.bothBefore = 2 ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + A.justExport = 4 + A.bothBefore = 2 - ~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothBefore'. -- A.bothAfter = 3 + A.bothAfter = 3 - ~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. -- module.exports = A -- function A() { -- this.p = 1 -- } -- module.exports.bothAfter = 'string' -- ~~~~~~~~~~~~~~~~~~~~~~~~ + module.exports = A ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + function A() { + this.p = 1 + } + module.exports.bothAfter = 'string' + ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2323: Cannot redeclare exported variable 'bothAfter'. -- module.exports.justProperty = 'string' -- -+ \ No newline at end of file ++!!! error TS2322: Type 'string' is not assignable to type 'number'. + module.exports.justProperty = 'string' ++ ~~~~~~~~~~~~ ++!!! error TS2339: Property 'justProperty' does not exist on type '{ (): void; justExport: number; bothBefore: number; bothAfter: number; }'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff index 2b31285acb..ad7a4d3685 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportWithExportPropertyAssignment4.types.diff @@ -6,46 +6,47 @@ var mod1 = require('./mod1') ->mod1 : typeof mod1 ->require('./mod1') : typeof mod1 -+>mod1 : any -+>require('./mod1') : any ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>require('./mod1') : { (): void; justExport: number; bothBefore: number; bothAfter: number; } >require : (name: string) => any >'./mod1' : "./mod1" - mod1.justExport.toFixed() -->mod1.justExport.toFixed() : string -->mod1.justExport.toFixed : (fractionDigits?: number) => string -->mod1.justExport : number +@@= skipped -9, +9 lines =@@ + >mod1.justExport.toFixed() : string + >mod1.justExport.toFixed : (fractionDigits?: number) => string + >mod1.justExport : number ->mod1 : typeof mod1 -->justExport : number -->toFixed : (fractionDigits?: number) => string -+>mod1.justExport.toFixed() : any -+>mod1.justExport.toFixed : any -+>mod1.justExport : any -+>mod1 : any -+>justExport : any -+>toFixed : any ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + >justExport : number + >toFixed : (fractionDigits?: number) => string mod1.bothBefore.toFixed() // error - >mod1.bothBefore.toFixed() : any - >mod1.bothBefore.toFixed : any +->mod1.bothBefore.toFixed() : any +->mod1.bothBefore.toFixed : any ->mod1.bothBefore : number | "string" ->mod1 : typeof mod1 ->bothBefore : number | "string" -+>mod1.bothBefore : any -+>mod1 : any -+>bothBefore : any - >toFixed : any +->toFixed : any ++>mod1.bothBefore.toFixed() : string ++>mod1.bothBefore.toFixed : (fractionDigits?: number) => string ++>mod1.bothBefore : number ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number ++>toFixed : (fractionDigits?: number) => string mod1.bothAfter.toFixed() - >mod1.bothAfter.toFixed() : any - >mod1.bothAfter.toFixed : any +->mod1.bothAfter.toFixed() : any +->mod1.bothAfter.toFixed : any ->mod1.bothAfter : number | "string" ->mod1 : typeof mod1 ->bothAfter : number | "string" -+>mod1.bothAfter : any -+>mod1 : any -+>bothAfter : any - >toFixed : any +->toFixed : any ++>mod1.bothAfter.toFixed() : string ++>mod1.bothAfter.toFixed : (fractionDigits?: number) => string ++>mod1.bothAfter : number ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number ++>toFixed : (fractionDigits?: number) => string mod1.justProperty.length ->mod1.justProperty.length : number @@ -55,80 +56,104 @@ ->length : number +>mod1.justProperty.length : any +>mod1.justProperty : any -+>mod1 : any ++>mod1 : { (): void; justExport: number; bothBefore: number; bothAfter: number; } +>justProperty : any +>length : any === requires.d.ts === declare var module: { exports: any }; -@@= skipped -44, +44 lines =@@ - declare function require(name: string): any; - >require : (name: string) => any - >name : string -- --=== mod1.js === --/// --module.exports.bothBefore = 'string' -->module.exports.bothBefore = 'string' : "string" +@@= skipped -40, +40 lines =@@ + /// + module.exports.bothBefore = 'string' + >module.exports.bothBefore = 'string' : "string" ->module.exports.bothBefore : number | "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->bothBefore : number | "string" -->'string' : "string" -- --A.justExport = 4 -->A.justExport = 4 : 4 -->A.justExport : number ++>module.exports.bothBefore : number ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number + >'string' : "string" + + A.justExport = 4 + >A.justExport = 4 : 4 + >A.justExport : number ->A : typeof A -->justExport : number -->4 : 4 -- --A.bothBefore = 2 -->A.bothBefore = 2 : 2 ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + >justExport : number + >4 : 4 + + A.bothBefore = 2 + >A.bothBefore = 2 : 2 ->A.bothBefore : number | "string" ->A : typeof A ->bothBefore : number | "string" -->2 : 2 -- --A.bothAfter = 3 -->A.bothAfter = 3 : 3 ++>A.bothBefore : number ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothBefore : number + >2 : 2 + + A.bothAfter = 3 + >A.bothAfter = 3 : 3 ->A.bothAfter : number | "string" ->A : typeof A ->bothAfter : number | "string" -->3 : 3 -- --module.exports = A ++>A.bothAfter : number ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number + >3 : 3 + + module.exports = A ->module.exports = A : typeof A ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->A : typeof A -- --function A() { ++>module.exports = A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + + function A() { ->A : typeof A -- -- this.p = 1 -->this.p = 1 : 1 -->this.p : any ++>A : { (): void; justExport: number; bothBefore: number; bothAfter: number; } + + this.p = 1 + >this.p = 1 : 1 + >this.p : any ->this : this -->p : any -->1 : 1 --} --module.exports.bothAfter = 'string' -->module.exports.bothAfter = 'string' : "string" ++>this : any + >p : any + >1 : 1 + } + module.exports.bothAfter = 'string' + >module.exports.bothAfter = 'string' : "string" ->module.exports.bothAfter : number | "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->bothAfter : number | "string" -->'string' : "string" -- --module.exports.justProperty = 'string' -->module.exports.justProperty = 'string' : "string" ++>module.exports.bothAfter : number ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>bothAfter : number + >'string' : "string" + + module.exports.justProperty = 'string' + >module.exports.justProperty = 'string' : "string" ->module.exports.justProperty : "string" ->module.exports : typeof A ->module : { exports: typeof A; } ->exports : typeof A ->justProperty : "string" -->'string' : "string" ++>module.exports.justProperty : any ++>module.exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>module : { A: { (): void; justExport: number; bothBefore: number; bothAfter: number; }; } ++>exports : { (): void; justExport: number; bothBefore: number; bothAfter: number; } ++>justProperty : any + >'string' : "string" diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff index 58e9a4a9cf..42b332e921 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.errors.txt.diff @@ -2,24 +2,27 @@ +++ new.moduleExportsElementAccessAssignment.errors.txt @@= skipped -0, +0 lines =@@ - -+mod2.js(1,22): error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. ++mod1.js(6,24): error TS2339: Property 'e' does not exist on type '{}'. ++mod2.js(6,8): error TS2339: Property 'e' does not exist on type '{}'. + + +==== mod2.js (1 errors) ==== + const mod1 = require("./mod1"); -+ ~~~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './mod1'. 'mod1.js' implicitly has an 'any' type. + mod1.a; + mod1.b; + mod1.c; + mod1.d; + mod1.d.e; ++ ~ ++!!! error TS2339: Property 'e' does not exist on type '{}'. + mod1.default; -+==== mod1.js (0 errors) ==== ++==== mod1.js (1 errors) ==== + exports.a = { x: "x" }; + exports["b"] = { x: "x" }; + exports["default"] = { x: "x" }; + module.exports["c"] = { x: "x" }; + module["exports"]["d"] = {}; + module["exports"]["d"].e = 0; ++ ~ ++!!! error TS2339: Property 'e' does not exist on type '{}'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff index 1621e3b757..af3ced87ac 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/moduleExportsElementAccessAssignment.types.diff @@ -1,123 +1,95 @@ --- old.moduleExportsElementAccessAssignment.types +++ new.moduleExportsElementAccessAssignment.types -@@= skipped -1, +1 lines =@@ - - === mod2.js === - const mod1 = require("./mod1"); -->mod1 : typeof mod1 -->require("./mod1") : typeof mod1 -+>mod1 : any -+>require("./mod1") : any - >require : any - >"./mod1" : "./mod1" - - mod1.a; -->mod1.a : { x: string; } -->mod1 : typeof mod1 -->a : { x: string; } -+>mod1.a : any -+>mod1 : any -+>a : any - - mod1.b; -->mod1.b : { x: string; } -->mod1 : typeof mod1 -->b : { x: string; } -+>mod1.b : any -+>mod1 : any -+>b : any - - mod1.c; -->mod1.c : { x: string; } -->mod1 : typeof mod1 -->c : { x: string; } -+>mod1.c : any -+>mod1 : any -+>c : any +@@= skipped -22, +22 lines =@@ + >c : { x: string; } mod1.d; ->mod1.d : typeof mod1."d" -->mod1 : typeof mod1 ++>mod1.d : {} + >mod1 : typeof mod1 ->d : typeof mod1."d" -+>mod1.d : any -+>mod1 : any -+>d : any ++>d : {} mod1.d.e; ->mod1.d.e : number ->mod1.d : typeof mod1."d" -->mod1 : typeof mod1 ++>mod1.d.e : any ++>mod1.d : {} + >mod1 : typeof mod1 ->d : typeof mod1."d" ->e : number -+>mod1.d.e : any -+>mod1.d : any -+>mod1 : any -+>d : any ++>d : {} +>e : any mod1.default; -->mod1.default : { x: string; } -->mod1 : typeof mod1 -->default : { x: string; } -- --=== mod1.js === --exports.a = { x: "x" }; -->exports.a = { x: "x" } : { x: string; } -->exports.a : { x: string; } + >mod1.default : { x: string; } +@@= skipped -20, +20 lines =@@ + exports.a = { x: "x" }; + >exports.a = { x: "x" } : { x: string; } + >exports.a : { x: string; } ->exports : typeof import("mod1") -->a : { x: string; } -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --exports["b"] = { x: "x" }; -->exports["b"] = { x: "x" } : { x: string; } -->exports["b"] : { x: string; } ++>exports : typeof import("./mod1") + >a : { x: string; } + >{ x: "x" } : { x: string; } + >x : string +@@= skipped -9, +9 lines =@@ + exports["b"] = { x: "x" }; + >exports["b"] = { x: "x" } : { x: string; } + >exports["b"] : { x: string; } ->exports : typeof import("mod1") -->"b" : "b" -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --exports["default"] = { x: "x" }; -->exports["default"] = { x: "x" } : { x: string; } -->exports["default"] : { x: string; } ++>exports : typeof import("./mod1") + >"b" : "b" + >{ x: "x" } : { x: string; } + >x : string +@@= skipped -9, +9 lines =@@ + exports["default"] = { x: "x" }; + >exports["default"] = { x: "x" } : { x: string; } + >exports["default"] : { x: string; } ->exports : typeof import("mod1") -->"default" : "default" -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --module.exports["c"] = { x: "x" }; -->module.exports["c"] = { x: "x" } : { x: string; } -->module.exports["c"] : { x: string; } ++>exports : typeof import("./mod1") + >"default" : "default" + >{ x: "x" } : { x: string; } + >x : string +@@= skipped -9, +9 lines =@@ + module.exports["c"] = { x: "x" }; + >module.exports["c"] = { x: "x" } : { x: string; } + >module.exports["c"] : { x: string; } ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->"c" : "c" -->{ x: "x" } : { x: string; } -->x : string -->"x" : "x" -- --module["exports"]["d"] = {}; ++>module.exports : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } ++>exports : typeof import("./mod1") + >"c" : "c" + >{ x: "x" } : { x: string; } + >x : string + >"x" : "x" + + module["exports"]["d"] = {}; ->module["exports"]["d"] = {} : typeof "d" ->module["exports"]["d"] : typeof "d" ->module["exports"] : typeof module.exports ->module : { exports: typeof module.exports; } -->"exports" : "exports" -->"d" : "d" -->{} : {} -- --module["exports"]["d"].e = 0; -->module["exports"]["d"].e = 0 : 0 ++>module["exports"]["d"] = {} : {} ++>module["exports"]["d"] : {} ++>module["exports"] : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } + >"exports" : "exports" + >"d" : "d" + >{} : {} + + module["exports"]["d"].e = 0; + >module["exports"]["d"].e = 0 : 0 ->module["exports"]["d"].e : number ->module["exports"]["d"] : typeof "d" ->module["exports"] : typeof module.exports ->module : { exports: typeof module.exports; } -->"exports" : "exports" -->"d" : "d" ++>module["exports"]["d"].e : any ++>module["exports"]["d"] : {} ++>module["exports"] : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } + >"exports" : "exports" + >"d" : "d" ->e : number -->0 : 0 -+>mod1.default : any -+>mod1 : any -+>default : any ++>e : any + >0 : 0 diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff index 99932aefa6..7ba795acec 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nestedDestructuringOfRequire.types.diff @@ -1,40 +1,23 @@ --- old.nestedDestructuringOfRequire.types +++ new.nestedDestructuringOfRequire.types -@@= skipped -3, +3 lines =@@ - const { - chalk: { grey } - >chalk : any -->grey : {} -+>grey : any +@@= skipped -6, +6 lines =@@ + >grey : {} } = require('./mod1'); ->require('./mod1') : typeof import("mod1") -+>require('./mod1') : any ++>require('./mod1') : typeof import("./mod1") >require : any >'./mod1' : "./mod1" - grey -->grey : {} -+>grey : any - - chalk - >chalk : any -- --=== mod1.js === --const chalk = { -->chalk : { grey: {}; } -->{ grey: {}} : { grey: {}; } -- -- grey: {} -->grey : {} -->{} : {} -- --}; --module.exports.chalk = chalk -->module.exports.chalk = chalk : { grey: {}; } -->module.exports.chalk : { grey: {}; } +@@= skipped -23, +23 lines =@@ + module.exports.chalk = chalk + >module.exports.chalk = chalk : { grey: {}; } + >module.exports.chalk : { grey: {}; } ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->chalk : { grey: {}; } -->chalk : { grey: {}; } ++>module.exports : typeof import("./mod1") ++>module : { "\"mod1\"": typeof import("./mod1"); } ++>exports : typeof import("./mod1") + >chalk : { grey: {}; } + >chalk : { grey: {}; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff index 6cba4a81fe..6e059f16d1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/paramTagTypeResolution.types.diff @@ -6,8 +6,8 @@ var f = require('./first'); ->f : (x: T, k: (t: T) => void) => void ->require('./first') : (x: T, k: (t: T) => void) => void -+>f : any -+>require('./first') : any ++>f : (x: any, k: any) => any ++>require('./first') : (x: any, k: any) => any >require : any >'./first' : "./first" @@ -15,17 +15,19 @@ ->f(1, n => { }) : void ->f : (x: T, k: (t: T) => void) => void +>f(1, n => { }) : any -+>f : any ++>f : (x: any, k: any) => any >1 : 1 ->n => { } : (n: number) => void ->n : number -- --=== first.js === --/** @template T -- * @param {T} x -- * @param {(t: T) => void} k -- */ --module.exports = function (x, k) { return k(x) } ++>n => { } : (n: any) => void ++>n : any + + === first.js === + /** @template T +@@= skipped -18, +18 lines =@@ + * @param {(t: T) => void} k + */ + module.exports = function (x, k) { return k(x) } ->module.exports = function (x, k) { return k(x) } : (x: T, k: (t: T) => void) => void ->module.exports : (x: T, k: (t: T) => void) => void ->module : { exports: (x: T, k: (t: T) => void) => void; } @@ -36,5 +38,13 @@ ->k(x) : void ->k : (t: T) => void ->x : T -+>n => { } : (n: any) => void -+>n : any ++>module.exports = function (x, k) { return k(x) } : (x: any, k: any) => any ++>module.exports : (x: any, k: any) => any ++>module : { "export=": (x: any, k: any) => any; } ++>exports : (x: any, k: any) => any ++>function (x, k) { return k(x) } : (x: any, k: any) => any ++>x : any ++>k : any ++>k(x) : any ++>k : any ++>x : any diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff index ca727e72a7..c4569297be 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/requireTwoPropertyAccesses.types.diff @@ -5,43 +5,22 @@ === requireTwoPropertyAccesses.js === const value = require("./mod").x.y ->value : error -->require("./mod").x.y : string -->require("./mod").x : { y: string; } -->require("./mod") : { x: { y: string; }; } -+>value : any -+>require("./mod").x.y : any -+>require("./mod").x : any -+>require("./mod") : any - >require : any - >"./mod" : "./mod" -->x : { y: string; } -->y : string -+>x : any -+>y : any - - console.log(value) - >console.log(value) : void ++>value : string + >require("./mod").x.y : string + >require("./mod").x : { y: string; } + >require("./mod") : { x: { y: string; }; } +@@= skipped -14, +14 lines =@@ >console.log : (...data: any[]) => void >console : Console >log : (...data: any[]) => void ->value : error -- --=== mod.js === --module.exports = { -->module.exports = { x: { y: "value" }} : { x: { y: string; }; } -->module.exports : { x: { y: string; }; } ++>value : string + + === mod.js === + module.exports = { + >module.exports = { x: { y: "value" }} : { x: { y: string; }; } + >module.exports : { x: { y: string; }; } ->module : { exports: { x: { y: string; }; }; } -->exports : { x: { y: string; }; } -->{ x: { y: "value" }} : { x: { y: string; }; } -- -- x: { -->x : { y: string; } -->{ y: "value" } : { y: string; } -- -- y: "value" -->y : string -->"value" : "value" -- } --} -+>value : any -+ \ No newline at end of file ++>module : { "export=": { x: { y: string; }; }; } + >exports : { x: { y: string; }; } + >{ x: { y: "value" }} : { x: { y: string; }; } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff new file mode 100644 index 0000000000..5f966384cc --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.errors.txt.diff @@ -0,0 +1,39 @@ +--- old.typeFromPropertyAssignment17.errors.txt ++++ new.typeFromPropertyAssignment17.errors.txt +@@= skipped -0, +0 lines =@@ +- ++use.js(3,8): error TS2554: Expected 1 arguments, but got 0. ++ ++ ++==== use.js (1 errors) ==== ++ /// ++ var mini = require('./minimatch') ++ mini.M.defaults() ++ ~~~~~~~~ ++!!! error TS2554: Expected 1 arguments, but got 0. ++!!! related TS6210 minimatch.js:10:24: An argument for 'def' was not provided. ++ var m = new mini.M() ++ m.m() ++ mini.filter() ++ ++==== types.d.ts (0 errors) ==== ++ declare var require: any; ++ declare var module: any; ++==== minimatch.js (0 errors) ==== ++ /// ++ module.exports = minimatch ++ minimatch.M = M ++ minimatch.filter = filter ++ function filter() { ++ return minimatch() ++ } ++ function minimatch() { ++ } ++ M.defaults = function (def) { ++ return def ++ } ++ M.prototype.m = function () { ++ } ++ function M() { ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff index ed75ccf902..fbcd2a1ad6 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment17.types.diff @@ -6,23 +6,21 @@ var mini = require('./minimatch') ->mini : typeof mini ->require('./minimatch') : typeof mini -+>mini : any -+>require('./minimatch') : any ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>require('./minimatch') : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } >require : any >'./minimatch' : "./minimatch" mini.M.defaults() >mini.M.defaults() : any -->mini.M.defaults : (def: any) => any + >mini.M.defaults : (def: any) => any ->mini.M : typeof M ->mini : typeof mini ->M : typeof M -->defaults : (def: any) => any -+>mini.M.defaults : any -+>mini.M : any -+>mini : any -+>M : any -+>defaults : any ++>mini.M : { (): void; defaults: (def: any) => any; } ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>M : { (): void; defaults: (def: any) => any; } + >defaults : (def: any) => any var m = new mini.M() ->m : M @@ -32,9 +30,9 @@ ->M : typeof M +>m : any +>new mini.M() : any -+>mini.M : any -+>mini : any -+>M : any ++>mini.M : { (): void; defaults: (def: any) => any; } ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>M : { (): void; defaults: (def: any) => any; } m.m() ->m.m() : void @@ -47,75 +45,78 @@ +>m : any mini.filter() -->mini.filter() : void -->mini.filter : () => void + >mini.filter() : void + >mini.filter : () => void ->mini : typeof mini -->filter : () => void -+>mini.filter() : any -+>mini.filter : any -+>mini : any -+>filter : any ++>mini : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + >filter : () => void === types.d.ts === - declare var require: any; -@@= skipped -38, +38 lines =@@ - - declare var module: any; - >module : any -- --=== minimatch.js === --/// --module.exports = minimatch +@@= skipped -42, +42 lines =@@ + === minimatch.js === + /// + module.exports = minimatch ->module.exports = minimatch : typeof minimatch ->module.exports : typeof minimatch ->module : { exports: typeof minimatch; } ->exports : typeof minimatch ->minimatch : typeof minimatch -- --minimatch.M = M ++>module.exports = minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>module.exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>module : { minimatch: { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; }; } ++>exports : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + + minimatch.M = M ->minimatch.M = M : typeof M ->minimatch.M : typeof M ->minimatch : typeof minimatch ->M : typeof M ->M : typeof M -- --minimatch.filter = filter -->minimatch.filter = filter : () => void -->minimatch.filter : () => void ++>minimatch.M = M : { (): void; defaults: (def: any) => any; } ++>minimatch.M : { (): void; defaults: (def: any) => any; } ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } ++>M : { (): void; defaults: (def: any) => any; } ++>M : { (): void; defaults: (def: any) => any; } + + minimatch.filter = filter + >minimatch.filter = filter : () => void + >minimatch.filter : () => void ->minimatch : typeof minimatch -->filter : () => void -->filter : () => void -- --function filter() { -->filter : () => void -- -- return minimatch() -->minimatch() : void ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + >filter : () => void + >filter : () => void + +@@= skipped -25, +25 lines =@@ + + return minimatch() + >minimatch() : void ->minimatch : typeof minimatch --} --function minimatch() { ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + } + function minimatch() { ->minimatch : typeof minimatch --} --M.defaults = function (def) { -->M.defaults = function (def) { return def} : (def: any) => any -->M.defaults : (def: any) => any ++>minimatch : { (): void; M: { (): void; defaults: (def: any) => any; }; filter: () => void; } + } + M.defaults = function (def) { + >M.defaults = function (def) { return def} : (def: any) => any + >M.defaults : (def: any) => any ->M : typeof M -->defaults : (def: any) => any -->function (def) { return def} : (def: any) => any -->def : any -- -- return def -->def : any --} --M.prototype.m = function () { -->M.prototype.m = function () {} : () => void -->M.prototype.m : any -->M.prototype : any ++>M : { (): void; defaults: (def: any) => any; } + >defaults : (def: any) => any + >function (def) { return def} : (def: any) => any + >def : any +@@= skipped -20, +20 lines =@@ + >M.prototype.m = function () {} : () => void + >M.prototype.m : any + >M.prototype : any ->M : typeof M -->prototype : any -->m : any -->function () {} : () => void --} --function M() { ++>M : { (): void; defaults: (def: any) => any; } + >prototype : any + >m : any + >function () {} : () => void + } + function M() { ->M : typeof M --} ++>M : { (): void; defaults: (def: any) => any; } + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.errors.txt.diff new file mode 100644 index 0000000000..861990632b --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.errors.txt.diff @@ -0,0 +1,27 @@ +--- old.typeFromPropertyAssignment19.errors.txt ++++ new.typeFromPropertyAssignment19.errors.txt +@@= skipped -0, +0 lines =@@ +- ++index.js(2,19): error TS2306: File 'semver.js' is not a module. ++semver.js(2,1): error TS2304: Cannot find name 'exports'. ++ ++ ++==== index.js (1 errors) ==== ++ /// ++ const C = require("./semver") ++ ~~~~~~~~~~ ++!!! error TS2306: File 'semver.js' is not a module. ++ var two = C.f(1) ++ ++==== types.d.ts (0 errors) ==== ++ declare var require: any; ++ declare var module: any; ++==== semver.js (1 errors) ==== ++ /// ++ exports = module.exports = C ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. ++ C.f = n => n + 1 ++ function C() { ++ this.p = 1 ++ } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff index 4ea70b9eb7..9e4b30cdaa 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment19.types.diff @@ -23,13 +23,10 @@ >1 : 1 === types.d.ts === -@@= skipped -20, +20 lines =@@ - declare var module: any; - >module : any - --=== semver.js === --/// --exports = module.exports = C +@@= skipped -23, +23 lines =@@ + === semver.js === + /// + exports = module.exports = C ->exports = module.exports = C : typeof C ->exports : typeof C ->module.exports = C : typeof C @@ -37,25 +34,34 @@ ->module : { exports: typeof C; } ->exports : typeof C ->C : typeof C -- --C.f = n => n + 1 -->C.f = n => n + 1 : (n: any) => any -->C.f : (n: any) => any ++>exports = module.exports = C : { (): void; f: (n: any) => any; } ++>exports : any ++>module.exports = C : { (): void; f: (n: any) => any; } ++>module.exports : any ++>module : any ++>exports : any ++>C : { (): void; f: (n: any) => any; } + + C.f = n => n + 1 + >C.f = n => n + 1 : (n: any) => any + >C.f : (n: any) => any ->C : typeof C -->f : (n: any) => any -->n => n + 1 : (n: any) => any -->n : any -->n + 1 : any -->n : any -->1 : 1 -- --function C() { ++>C : { (): void; f: (n: any) => any; } + >f : (n: any) => any + >n => n + 1 : (n: any) => any + >n : any +@@= skipped -20, +20 lines =@@ + >1 : 1 + + function C() { ->C : typeof C -- -- this.p = 1 -->this.p = 1 : 1 -->this.p : any ++>C : { (): void; f: (n: any) => any; } + + this.p = 1 + >this.p = 1 : 1 + >this.p : any ->this : this -->p : any -->1 : 1 --} \ No newline at end of file ++>this : any + >p : any + >1 : 1 + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.errors.txt.diff new file mode 100644 index 0000000000..500a5ce5d3 --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.errors.txt.diff @@ -0,0 +1,31 @@ +--- old.typeFromPropertyAssignment37.errors.txt ++++ new.typeFromPropertyAssignment37.errors.txt +@@= skipped -0, +0 lines =@@ +- ++mod.js(1,14): error TS2304: Cannot find name 'exports'. ++mod.js(1,24): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++mod.js(3,10): error TS2339: Property 'existy' does not exist on type '{}'. ++use.js(1,22): error TS2306: File 'mod.js' is not a module. ++ ++ ++==== use.js (1 errors) ==== ++ const util = require('./mod') ++ ~~~~~~~ ++!!! error TS2306: File 'mod.js' is not a module. ++ function n() { ++ util.existy // no error ++ } ++ util.existy // no error ++ ++==== mod.js (3 errors) ==== ++ const util = exports = module.exports = {} ++ ~~~~~~~ ++!!! error TS2304: Cannot find name 'exports'. ++ ~~~~~~ ++!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ if (!!false) { ++ util.existy = function () { } ++ ~~~~~~ ++!!! error TS2339: Property 'existy' does not exist on type '{}'. ++ } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff index 8b5456b8b0..32ea4c53c1 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typeFromPropertyAssignment37.types.diff @@ -26,9 +26,12 @@ ->util.existy : () => void ->util : typeof util ->existy : () => void -- --=== mod.js === --const util = exports = module.exports = {} ++>util.existy : any ++>util : any ++>existy : any + + === mod.js === + const util = exports = module.exports = {} ->util : typeof module.exports ->exports = module.exports = {} : typeof module.exports ->exports : typeof import("mod") @@ -36,20 +39,25 @@ ->module.exports : typeof module.exports ->module : { exports: typeof module.exports; } ->exports : typeof module.exports -->{} : {} -- --if (!!false) { -->!!false : boolean -->!false : true -->false : false -- -- util.existy = function () { } -->util.existy = function () { } : () => void ++>util : {} ++>exports = module.exports = {} : {} ++>exports : any ++>module.exports = {} : {} ++>module.exports : any ++>module : any ++>exports : any + >{} : {} + + if (!!false) { +@@= skipped -27, +27 lines =@@ + + util.existy = function () { } + >util.existy = function () { } : () => void ->util.existy : () => void ->util : typeof module.exports ->existy : () => void -->function () { } : () => void --} +>util.existy : any -+>util : any ++>util : {} +>existy : any + >function () { } : () => void + } diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff index b78e86ee38..0a4e1b8385 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.errors.txt.diff @@ -8,48 +8,84 @@ - - -==== use.js (0 errors) ==== -- var mod = require('./mod1.js'); -- /** @type {import("./mod1.js").Baz} */ -- var b; -- /** @type {mod.Baz} */ -- var bb; -- var bbb = new mod.Baz(); -- ++mod1.js(3,23): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. ++mod1.js(4,7): error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. ++mod1.js(7,9): error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. ++mod1.js(10,1): error TS2300: Duplicate identifier 'export='. ++mod1.js(10,1): error TS2309: An export assignment cannot be used in a module with other exported elements. ++mod1.js(20,9): error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. ++mod1.js(23,1): error TS2300: Duplicate identifier 'export='. ++mod1.js(24,5): error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. ++use.js(2,32): error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. ++use.js(4,12): error TS2503: Cannot find namespace 'mod'. ++ ++ ++==== use.js (2 errors) ==== + var mod = require('./mod1.js'); + /** @type {import("./mod1.js").Baz} */ ++ ~~~ ++!!! error TS2694: Namespace '"mod1".export=' has no exported member 'Baz'. + var b; + /** @type {mod.Baz} */ ++ ~~~ ++!!! error TS2503: Cannot find namespace 'mod'. + var bb; + var bbb = new mod.Baz(); + -==== mod1.js (4 errors) ==== -- // error -- -- /** @typedef {number} Foo */ -- ~~~ ++==== mod1.js (8 errors) ==== + // error + + /** @typedef {number} Foo */ + ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- class Foo { } // should error -- ~~~ ++!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + class Foo { } // should error + ~~~ -!!! error TS2300: Duplicate identifier 'Foo'. -- -- /** @typedef {number} Bar */ -- exports.Bar = class { } -- -- /** @typedef {number} Baz */ ++!!! error TS2395: Individual declarations in merged declaration 'Foo' must be all exported or all local. + + /** @typedef {number} Bar */ + exports.Bar = class { } ++ ~~~ ++!!! error TS2339: Property 'Bar' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Baz */ - ~~~ -!!! error TS2300: Duplicate identifier 'Baz'. -!!! related TS6203 mod1.js:11:5: 'Baz' was also declared here. -- module.exports = { -- Baz: class { } + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~~~ + Baz: class { } - ~~~ -!!! error TS2300: Duplicate identifier 'Baz'. -!!! related TS6203 mod1.js:9:23: 'Baz' was also declared here. -- } -- -- // ok -- -- /** @typedef {number} Qux */ -- var Qux = 2; -- -- /** @typedef {number} Quid */ -- exports.Quid = 2; -- -- /** @typedef {number} Quack */ -- module.exports = { -- Quack: 2 -- } -- -+ \ No newline at end of file ++ ~~~~~~~~~~~~~~~~~~ ++ ~~~~~~~~~~~~~~~~~~ + } ++ ~ ++!!! error TS2300: Duplicate identifier 'export='. ++ ~ ++!!! error TS2309: An export assignment cannot be used in a module with other exported elements. + + // ok + +@@= skipped -42, +56 lines =@@ + + /** @typedef {number} Quid */ + exports.Quid = 2; ++ ~~~~ ++!!! error TS2339: Property 'Quid' does not exist on type 'typeof import("mod1")'. + + /** @typedef {number} Quack */ + module.exports = { ++ ~~~~~~~~~~~~~~~~~~ + Quack: 2 ++ ~~~~~~~~~~~~ ++ ~~~~~ ++!!! error TS2353: Object literal may only specify known properties, and 'Quack' does not exist in type '{ Baz: typeof Baz; }'. + } ++ ~ ++!!! error TS2300: Duplicate identifier 'export='. + \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff index 0a1418e7be..f33a595b97 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/typedefCrossModule2.types.diff @@ -6,8 +6,8 @@ var mod = require('./mod1.js'); ->mod : { Bar: typeof mod.Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof mod.Bar; Baz?: undefined; Quid: 2; Quack: number; } ->require('./mod1.js') : { Bar: typeof mod.Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof mod.Bar; Baz?: undefined; Quid: 2; Quack: number; } -+>mod : any -+>require('./mod1.js') : any ++>mod : { Baz: typeof Baz; } ++>require('./mod1.js') : { Baz: typeof Baz; } >require : any >'./mod1.js' : "./mod1.js" @@ -19,72 +19,64 @@ /** @type {mod.Baz} */ var bb; ->bb : number -+>bb : error ++>bb : mod.Baz var bbb = new mod.Baz(); -->bbb : Baz -->new mod.Baz() : Baz -->mod.Baz : typeof Baz + >bbb : Baz + >new mod.Baz() : Baz + >mod.Baz : typeof Baz ->mod : { Bar: typeof mod.Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof mod.Bar; Baz?: undefined; Quid: 2; Quack: number; } -->Baz : typeof Baz -- --=== mod1.js === --// error -- --/** @typedef {number} Foo */ --class Foo { } // should error -->Foo : Foo -- --/** @typedef {number} Bar */ --exports.Bar = class { } -->exports.Bar = class { } : typeof Bar ++>mod : { Baz: typeof Baz; } + >Baz : typeof Baz + + === mod1.js === +@@= skipped -30, +30 lines =@@ + /** @typedef {number} Bar */ + exports.Bar = class { } + >exports.Bar = class { } : typeof Bar ->exports.Bar : typeof Bar ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->Bar : typeof Bar -->class { } : typeof Bar -- --/** @typedef {number} Baz */ --module.exports = { ++>exports.Bar : any ++>exports : typeof import("./mod1") ++>Bar : any + >class { } : typeof Bar + + /** @typedef {number} Baz */ + module.exports = { ->module.exports = { Baz: class { }} : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module.exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module : { exports: { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; }; } ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->{ Baz: class { }} : { Baz: typeof Baz; } -- -- Baz: class { } -->Baz : typeof Baz -->class { } : typeof Baz --} -- --// ok -- --/** @typedef {number} Qux */ --var Qux = 2; -->Qux : number -->2 : 2 -- --/** @typedef {number} Quid */ --exports.Quid = 2; -->exports.Quid = 2 : 2 ++>module.exports = { Baz: class { }} : { Baz: typeof Baz; } ++>module.exports : { Baz: typeof Baz; } ++>module : { "export=": { Baz: typeof Baz; }; } ++>exports : { Baz: typeof Baz; } + >{ Baz: class { }} : { Baz: typeof Baz; } + + Baz: class { } +@@= skipped -28, +28 lines =@@ + /** @typedef {number} Quid */ + exports.Quid = 2; + >exports.Quid = 2 : 2 ->exports.Quid : 2 ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->Quid : 2 -->2 : 2 -- --/** @typedef {number} Quack */ --module.exports = { ++>exports.Quid : any ++>exports : typeof import("./mod1") ++>Quid : any + >2 : 2 + + /** @typedef {number} Quack */ + module.exports = { ->module.exports = { Quack: 2} : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module.exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } ->module : { exports: { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; }; } ->exports : { Bar: typeof Bar; Baz: typeof Baz; Quid: 2; Quack?: undefined; } | { Bar: typeof Bar; Baz?: undefined; Quid: 2; Quack: number; } -->{ Quack: 2} : { Quack: number; } -- -- Quack: 2 -->Quack : number -->2 : 2 --} -+>bbb : any -+>new mod.Baz() : any -+>mod.Baz : any -+>mod : any -+>Baz : any ++>module.exports = { Quack: 2} : { Quack: number; } ++>module.exports : { Baz: typeof Baz; } ++>module : { "export=": { Baz: typeof Baz; }; } ++>exports : { Baz: typeof Baz; } + >{ Quack: 2} : { Quack: number; } + + Quack: 2 \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff new file mode 100644 index 0000000000..24172272bd --- /dev/null +++ b/testdata/baselines/reference/submoduleAccepted/conformance/untypedModuleImport_allowJs.types.diff @@ -0,0 +1,11 @@ +--- old.untypedModuleImport_allowJs.types ++++ new.untypedModuleImport_allowJs.types +@@= skipped -13, +13 lines =@@ + exports.default = { bar() { return 0; } } + >exports.default = { bar() { return 0; } } : { bar(): number; } + >exports.default : { bar(): number; } +->exports : typeof import("/node_modules/foo/index") ++>exports : typeof import("foo") + >default : { bar(): number; } + >{ bar() { return 0; } } : { bar(): number; } + >bar : () => number \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff deleted file mode 100644 index 3800b1ceac..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.varRequireFromJavascript.errors.txt -+++ new.varRequireFromJavascript.errors.txt -@@= skipped -0, +0 lines =@@ -- -+use.js(1,18): error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. -+ -+ -+==== use.js (1 errors) ==== -+ var ex = require('./ex') -+ ~~~~~~ -+!!! error TS7016: Could not find a declaration file for module './ex'. 'ex.js' implicitly has an 'any' type. -+ -+ // values work -+ var crunch = new ex.Crunch(1); -+ crunch.n -+ -+ -+ // types work -+ /** -+ * @param {ex.Crunch} wrap -+ */ -+ function f(wrap) { -+ wrap.n -+ } -+ -+==== ex.js (0 errors) ==== -+ export class Crunch { -+ /** @param {number} n */ -+ constructor(n) { -+ this.n = n -+ } -+ m() { -+ return this.n -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff index 8a0d20b5bc..2b7ca5fdd7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/varRequireFromJavascript.types.diff @@ -1,71 +1,14 @@ --- old.varRequireFromJavascript.types +++ new.varRequireFromJavascript.types -@@= skipped -1, +1 lines =@@ +@@= skipped -45, +45 lines =@@ - === use.js === - var ex = require('./ex') -->ex : typeof ex -->require('./ex') : typeof ex -+>ex : any -+>require('./ex') : any - >require : any - >'./ex' : "./ex" - - // values work - var crunch = new ex.Crunch(1); -->crunch : ex.Crunch -->new ex.Crunch(1) : ex.Crunch -->ex.Crunch : typeof ex.Crunch -->ex : typeof ex -->Crunch : typeof ex.Crunch -+>crunch : any -+>new ex.Crunch(1) : any -+>ex.Crunch : any -+>ex : any -+>Crunch : any - >1 : 1 - - crunch.n -->crunch.n : number -->crunch : ex.Crunch -->n : number -+>crunch.n : any -+>crunch : any -+>n : any - - - // types work -@@= skipped -29, +29 lines =@@ - >wrap : ex.Crunch - - wrap.n -->wrap.n : number -+>wrap.n : any - >wrap : ex.Crunch -->n : number --} -- --=== ex.js === --export class Crunch { -->Crunch : Crunch -- -- /** @param {number} n */ -- constructor(n) { -->n : number -- -- this.n = n -->this.n = n : number + this.n = n + >this.n = n : number ->this.n : any -->this : this - >n : any -->n : number -- } -- m() { -->m : () => number -- -- return this.n -->this.n : number -->this : this -->n : number -- } - } ++>this.n : number + >this : this +->n : any ++>n : number + >n : number + } + m() { \ No newline at end of file