diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1740df24a15c6..cf26af1c2f8cd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -51385,9 +51385,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { // Initialize global symbol table let augmentations: (readonly (StringLiteral | Identifier)[])[] | undefined; for (const file of host.getSourceFiles()) { - if (file.redirectInfo) { - continue; - } if (!isExternalOrCommonJsModule(file)) { // It is an error for a non-external-module (i.e. script) to declare its own `globalThis`. const fileGlobalThisSymbol = file.locals!.get("globalThis" as __String); @@ -53689,7 +53686,6 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host: TypeCheckerHo getSymlinkCache: maybeBind(host, host.getSymlinkCache), getPackageJsonInfoCache: () => host.getPackageJsonInfoCache?.(), useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(), - redirectTargetsMap: host.redirectTargetsMap, getRedirectFromSourceFile: fileName => host.getRedirectFromSourceFile(fileName), isSourceOfProjectReferenceRedirect: fileName => host.isSourceOfProjectReferenceRedirect(fileName), fileExists: fileName => host.fileExists(fileName), diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index e31d925fadd8f..f42cc0ffae448 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -375,7 +375,6 @@ import { QuestionDotToken, QuestionToken, ReadonlyKeyword, - RedirectInfo, reduceLeft, RegularExpressionLiteral, RestTypeNode, @@ -1003,7 +1002,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode updateEnumMember, createSourceFile, updateSourceFile, - createRedirectedSourceFile, createBundle, updateBundle, createSyntheticExpression, @@ -6092,43 +6090,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode return node; } - function createRedirectedSourceFile(redirectInfo: RedirectInfo) { - const node: SourceFile = Object.create(redirectInfo.redirectTarget); - Object.defineProperties(node, { - id: { - get(this: SourceFile) { - return this.redirectInfo!.redirectTarget.id; - }, - set(this: SourceFile, value: SourceFile["id"]) { - this.redirectInfo!.redirectTarget.id = value; - }, - }, - symbol: { - get(this: SourceFile) { - return this.redirectInfo!.redirectTarget.symbol; - }, - set(this: SourceFile, value: SourceFile["symbol"]) { - this.redirectInfo!.redirectTarget.symbol = value; - }, - }, - }); - node.redirectInfo = redirectInfo; - return node; - } - - function cloneRedirectedSourceFile(source: SourceFile) { - const node = createRedirectedSourceFile(source.redirectInfo!) as Mutable; - node.flags |= source.flags & ~NodeFlags.Synthesized; - node.fileName = source.fileName; - node.path = source.path; - node.resolvedPath = source.resolvedPath; - node.originalFileName = source.originalFileName; - node.packageJsonLocations = source.packageJsonLocations; - node.packageJsonScope = source.packageJsonScope; - node.emitNode = undefined; - return node; - } - function cloneSourceFileWorker(source: SourceFile) { // TODO: This mechanism for cloning results in megamorphic property reads and writes. In future perf-related // work, we should consider switching explicit property assignments instead of using `for..in`. @@ -6148,7 +6109,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } function cloneSourceFile(source: SourceFile) { - const node = source.redirectInfo ? cloneRedirectedSourceFile(source) : cloneSourceFileWorker(source); + const node = cloneSourceFileWorker(source); setOriginal(node, source); return node; } diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 8860677e6cab1..fc5863be1c78c 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -720,9 +720,7 @@ export function forEachFileNameOfModule( const getCanonicalFileName = hostGetCanonicalFileName(host); const cwd = host.getCurrentDirectory(); const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? host.getRedirectFromSourceFile(importedFileName)?.outputDts : undefined; - const importedPath = toPath(importedFileName, cwd, getCanonicalFileName); - const redirects = host.redirectTargetsMap.get(importedPath) || emptyArray; - const importedFileNames = [...(referenceRedirect ? [referenceRedirect] : emptyArray), importedFileName, ...redirects]; + const importedFileNames = [...(referenceRedirect ? [referenceRedirect] : emptyArray), importedFileName]; const targets = importedFileNames.map(f => getNormalizedAbsolutePath(f, cwd)); let shouldFilterIgnoredPaths = !every(targets, containsIgnoredPath); diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 23ecd881ec09c..55c458c097874 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -41,7 +41,6 @@ import { createModeAwareCache, createModeAwareCacheKey, createModuleResolutionCache, - createMultiMap, createProgramDiagnostics, CreateProgramOptions, createSourceFile, @@ -238,7 +237,6 @@ import { optionDeclarations, optionsHaveChanges, PackageId, - packageIdToPackageName, packageIdToString, PackageJsonInfoCache, ParameterDeclaration, @@ -246,7 +244,6 @@ import { ParsedCommandLine, parseIsolatedEntityName, parseJsonSourceFileConfigFileContent, - parseNodeFactory, Path, pathContainsNodeModules, pathIsAbsolute, @@ -1688,14 +1685,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro actualResolveLibrary = (libraryName, resolveFrom, options) => resolveLibrary(libraryName, resolveFrom, options, host, libraryResolutionCache); } - // Map from a stringified PackageId to the source file with that id. - // Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile). - // `packageIdToSourceFile` is only used while building the program, while `sourceFileToPackageName` and `isSourceFileTargetOfRedirect` are kept around. - const packageIdToSourceFile = new Map(); - // Maps from a SourceFile's `.path` to the name of the package it was imported with. - let sourceFileToPackageName = new Map(); - // Key is a file name. Value is the (non-empty, or undefined) list of files that redirect to it. - let redirectTargetsMap = createMultiMap(); let usesUriStyleNodeCoreModules: boolean | undefined; /** @@ -1910,8 +1899,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro getModeForResolutionAtIndex, getSourceFileFromReference, getLibFileFromReference, - sourceFileToPackageName, - redirectTargetsMap, usesUriStyleNodeCoreModules, resolvedModules, resolvedTypeReferenceDirectiveNames, @@ -2379,15 +2366,10 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro } const oldSourceFiles = oldProgram.getSourceFiles(); - const enum SeenPackageName { - Exists, - Modified, - } - const seenPackageNames = new Map(); for (const oldSourceFile of oldSourceFiles) { const sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options); - let newSourceFile = host.getSourceFileByPath + const newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile) : host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217 @@ -2397,29 +2379,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro newSourceFile.packageJsonLocations = sourceFileOptions.packageJsonLocations?.length ? sourceFileOptions.packageJsonLocations : undefined; newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope; - Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`"); - - let fileChanged: boolean; - if (oldSourceFile.redirectInfo) { - // We got `newSourceFile` by path, so it is actually for the unredirected file. - // This lets us know if the unredirected file has changed. If it has we should break the redirect. - if (newSourceFile !== oldSourceFile.redirectInfo.unredirected) { - // Underlying file has changed. Might not redirect anymore. Must rebuild program. - return StructureIsReused.Not; - } - fileChanged = false; - newSourceFile = oldSourceFile; // Use the redirect. - } - else if (oldProgram.redirectTargetsMap.has(oldSourceFile.path)) { - // If a redirected-to source file changes, the redirect may be broken. - if (newSourceFile !== oldSourceFile) { - return StructureIsReused.Not; - } - fileChanged = false; - } - else { - fileChanged = newSourceFile !== oldSourceFile; - } + const fileChanged = newSourceFile !== oldSourceFile; // Since the project references havent changed, its right to set originalFileName and resolvedPath here newSourceFile.path = oldSourceFile.path; @@ -2427,18 +2387,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro newSourceFile.resolvedPath = oldSourceFile.resolvedPath; newSourceFile.fileName = oldSourceFile.fileName; - const packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path); - if (packageName !== undefined) { - // If there are 2 different source files for the same package name and at least one of them changes, - // they might become redirects. So we must rebuild the program. - const prevKind = seenPackageNames.get(packageName); - const newKind = fileChanged ? SeenPackageName.Modified : SeenPackageName.Exists; - if ((prevKind !== undefined && newKind === SeenPackageName.Modified) || prevKind === SeenPackageName.Modified) { - return StructureIsReused.Not; - } - seenPackageNames.set(packageName, newKind); - } - if (fileChanged) { if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) { structureIsReused = StructureIsReused.SafeModules; @@ -2579,8 +2527,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames(); automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions(); - sourceFileToPackageName = oldProgram.sourceFileToPackageName; - redirectTargetsMap = oldProgram.redirectTargetsMap; usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules; resolvedModules = oldProgram.resolvedModules; resolvedTypeReferenceDirectiveNames = oldProgram.resolvedTypeReferenceDirectiveNames; @@ -2622,7 +2568,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(), getBuildInfo: () => program.getBuildInfo?.(), getSourceFileFromReference: (file, ref) => program.getSourceFileFromReference(file, ref), - redirectTargetsMap, getFileIncludeReasons: program.getFileIncludeReasons, createHash: maybeBind(host, host.createHash), getModuleResolutionCache: () => program.getModuleResolutionCache(), @@ -3501,18 +3446,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro } } - function createRedirectedSourceFile(redirectTarget: SourceFile, unredirected: SourceFile, fileName: string, path: Path, resolvedPath: Path, originalFileName: string, sourceFileOptions: CreateSourceFileOptions): SourceFile { - const redirect = parseNodeFactory.createRedirectedSourceFile({ redirectTarget, unredirected }); - redirect.fileName = fileName; - redirect.path = path; - redirect.resolvedPath = resolvedPath; - redirect.originalFileName = originalFileName; - redirect.packageJsonLocations = sourceFileOptions.packageJsonLocations?.length ? sourceFileOptions.packageJsonLocations : undefined; - redirect.packageJsonScope = sourceFileOptions.packageJsonScope; - sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); - return redirect; - } - // Get source file from normalized fileName function findSourceFile(fileName: string, isDefaultLib: boolean, reason: FileIncludeReason, packageId: PackageId | undefined): SourceFile | undefined { tracing?.push(tracing.Phase.Program, "findSourceFile", { @@ -3634,26 +3567,6 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro shouldCreateNewSourceFile, ); - if (packageId) { - const packageIdKey = packageIdToString(packageId); - const fileFromPackageId = packageIdToSourceFile.get(packageIdKey); - if (fileFromPackageId) { - // Some other SourceFile already exists with this package name and version. - // Instead of creating a duplicate, just redirect to the existing one. - const dupFile = createRedirectedSourceFile(fileFromPackageId, file!, fileName, path, toPath(fileName), originalFileName, sourceFileOptions); - redirectTargetsMap.add(fileFromPackageId.path, fileName); - addFileToFilesByName(dupFile, path, fileName, redirectedPath); - addFileIncludeReason(dupFile, reason, /*checkExisting*/ false); - sourceFileToPackageName.set(path, packageIdToPackageName(packageId)); - processingOtherFiles!.push(dupFile); - return dupFile; - } - else if (file) { - // This is the first source file to have this packageId. - packageIdToSourceFile.set(packageIdKey, file); - sourceFileToPackageName.set(path, packageIdToPackageName(packageId)); - } - } addFileToFilesByName(file, path, fileName, redirectedPath); if (file) { diff --git a/src/compiler/programDiagnostics.ts b/src/compiler/programDiagnostics.ts index ee4d1161eaa19..b2f65a397518a 100644 --- a/src/compiler/programDiagnostics.ts +++ b/src/compiler/programDiagnostics.ts @@ -16,7 +16,6 @@ import { Diagnostics, DiagnosticWithLocation, emptyArray, - explainIfFileIsRedirectAndImpliedFormat, FileIncludeKind, FileIncludeReason, fileIncludeReasonToDiagnostics, @@ -56,7 +55,6 @@ import { interface FileReasonToChainCache { fileIncludeReasonDetails: DiagnosticMessageChain | undefined; - redirectInfo: DiagnosticMessageChain[] | undefined; details?: DiagnosticMessageChain[]; } @@ -207,7 +205,6 @@ export function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax: let fileIncludeReasons: DiagnosticMessageChain[] | undefined; let relatedInfo: DiagnosticWithLocation[] | undefined; let fileIncludeReasonDetails: DiagnosticMessageChain | undefined; - let redirectInfo: DiagnosticMessageChain[] | undefined; let chain: DiagnosticMessageChain | undefined; const reasons = file && fileReasons.get(file.path); @@ -221,11 +218,9 @@ export function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax: else { reasons?.forEach(processReason); } - redirectInfo = cachedChain.redirectInfo; } else { reasons?.forEach(processReason); - redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file)); } if (fileProcessingReason) processReason(fileProcessingReason); @@ -261,9 +256,7 @@ export function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax: if (!chain) { if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon); chain = chainDiagnosticMessages( - redirectInfo ? - fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : - fileIncludeReasonDetails, + fileIncludeReasonDetails, diagnostic, ...args || emptyArray, ); @@ -285,7 +278,7 @@ export function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax: } } else { - (fileReasonsToChain ??= new Map()).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo }); + (fileReasonsToChain ??= new Map()).set(file.path, cachedChain = { fileIncludeReasonDetails }); } // If we didnt compute extra file include reason , cache the details to use directly if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 626bcecf9d34a..522ca964bb5e0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4302,17 +4302,6 @@ export interface FutureSourceFile { readonly imports: readonly never[]; } -/** @internal */ -export interface RedirectInfo { - /** Source file this redirects to. */ - readonly redirectTarget: SourceFile; - /** - * Source file for the duplicate package. This will not be used by the Program, - * but we need to keep this around so we can watch for changes in underlying. - */ - readonly unredirected: SourceFile; -} - export type ResolutionMode = ModuleKind.ESNext | ModuleKind.CommonJS | undefined; // Source files are declarations when they are external modules. @@ -4341,15 +4330,6 @@ export interface SourceFile extends Declaration, LocalsContainer { */ originalFileName: string; - /** - * If two source files are for the same version of the same package, one will redirect to the other. - * (See `createRedirectSourceFile` in program.ts.) - * The redirect will have this set. The redirected-to source file will be in `redirectTargetsMap`. - * - * @internal - */ - redirectInfo?: RedirectInfo; - amdDependencies: readonly AmdDependency[]; moduleName?: string; referencedFiles: readonly FileReference[]; @@ -4880,18 +4860,6 @@ export interface Program extends ScriptReferenceHost { /** @internal */ getSourceFileFromReference(referencingFile: SourceFile, ref: FileReference): SourceFile | undefined; /** @internal */ getLibFileFromReference(ref: FileReference): SourceFile | undefined; - /** - * Given a source file, get the name of the package it was imported from. - * - * @internal - */ - sourceFileToPackageName: Map; - /** - * Set of all source files that some other source file redirects to. - * - * @internal - */ - redirectTargetsMap: MultiMap; /** * Whether any (non-external, non-declaration) source files use `node:`-prefixed module specifiers * (except for those that are not available without the prefix). @@ -4950,9 +4918,6 @@ export interface Program extends ScriptReferenceHost { export interface Program extends TypeCheckerHost, ModuleSpecifierResolutionHost { } -/** @internal */ -export type RedirectTargetsMap = ReadonlyMap; - export interface ResolvedProjectReference { commandLine: ParsedCommandLine; sourceFile: SourceFile; @@ -5054,8 +5019,6 @@ export interface TypeCheckerHost extends ModuleSpecifierResolutionHost, SourceFi getResolvedModule(f: SourceFile, moduleName: string, mode: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined; - readonly redirectTargetsMap: RedirectTargetsMap; - typesPackageExists(packageName: string): boolean; packageBundlesTypes(packageName: string): boolean; @@ -8598,7 +8561,6 @@ export interface EmitHost extends ScriptReferenceHost, ModuleSpecifierResolution writeFile: WriteFileCallback; getBuildInfo(): BuildInfo | undefined; getSourceFileFromReference: Program["getSourceFileFromReference"]; - readonly redirectTargetsMap: RedirectTargetsMap; createHash?(data: string): string; } @@ -9270,8 +9232,6 @@ export interface NodeFactory { createSourceFile(statements: readonly Statement[], endOfFileToken: EndOfFileToken, flags: NodeFlags): SourceFile; updateSourceFile(node: SourceFile, statements: readonly Statement[], isDeclarationFile?: boolean, referencedFiles?: readonly FileReference[], typeReferences?: readonly FileReference[], hasNoDefaultLib?: boolean, libReferences?: readonly FileReference[]): SourceFile; - /** @internal */ createRedirectedSourceFile(redirectInfo: RedirectInfo): SourceFile; - // // Synthetic Nodes // @@ -9978,7 +9938,6 @@ export interface ModuleSpecifierResolutionHost { getGlobalTypingsCacheLocation?(): string | undefined; getNearestAncestorDirectoryWithPackageJson?(fileName: string, rootDir?: string): string | undefined; - readonly redirectTargetsMap: RedirectTargetsMap; getRedirectFromSourceFile(fileName: string): ResolvedRefAndOutputDts | undefined; isSourceOfProjectReferenceRedirect(fileName: string): boolean; getFileIncludeReasons(): MultiMap; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9805b7ae9b1e4..257ed962a30eb 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -901,8 +901,7 @@ function packageIdIsEqual(a: PackageId | undefined, b: PackageId | undefined): b return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies; } -/** @internal */ -export function packageIdToPackageName({ name, subModuleName }: PackageId): string { +function packageIdToPackageName({ name, subModuleName }: PackageId): string { return subModuleName ? `${name}/${subModuleName}` : name; } diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 4a49afdc36492..20c0cb6e57070 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -357,8 +357,7 @@ export function explainFiles(program: Program, write: (s: string) => void): void } } -/** @internal */ -export function explainIfFileIsRedirectAndImpliedFormat( +function explainIfFileIsRedirectAndImpliedFormat( file: SourceFile, options: CompilerOptions, fileNameConvertor?: (fileName: string) => string, @@ -371,13 +370,6 @@ export function explainIfFileIsRedirectAndImpliedFormat( toFileName(file.originalFileName, fileNameConvertor), )); } - if (file.redirectInfo) { - (result ??= []).push(chainDiagnosticMessages( - /*details*/ undefined, - Diagnostics.File_redirects_to_file_0, - toFileName(file.redirectInfo.redirectTarget, fileNameConvertor), - )); - } if (isExternalOrCommonJsModule(file)) { switch (getImpliedNodeFormatForEmitWorker(file, options)) { case ModuleKind.ESNext: diff --git a/src/services/documentHighlights.ts b/src/services/documentHighlights.ts index 644f0a125657c..40678b9066e40 100644 --- a/src/services/documentHighlights.ts +++ b/src/services/documentHighlights.ts @@ -11,10 +11,8 @@ import { concatenate, ConstructorDeclaration, contains, - createGetCanonicalFileName, createTextSpanFromBounds, createTextSpanFromNode, - Debug, DefaultClause, find, FindAllReferences, @@ -77,7 +75,6 @@ import { SyntaxKind, ThrowStatement, toArray, - toPath, tryCast, TryStatement, } from "./_namespaces/ts.js"; @@ -115,16 +112,9 @@ export namespace DocumentHighlights { const referenceEntries = FindAllReferences.getReferenceEntriesForNode(position, node, program, sourceFilesToSearch, cancellationToken, /*options*/ undefined, sourceFilesSet); if (!referenceEntries) return undefined; const map = arrayToMultiMap(referenceEntries.map(FindAllReferences.toHighlightSpan), e => e.fileName, e => e.span); - const getCanonicalFileName = createGetCanonicalFileName(program.useCaseSensitiveFileNames()); return arrayFrom(mapDefinedIterator(map.entries(), ([fileName, highlightSpans]) => { if (!sourceFilesSet.has(fileName)) { - if (!program.redirectTargetsMap.has(toPath(fileName, program.getCurrentDirectory(), getCanonicalFileName))) { - return undefined; - } - const redirectTarget = program.getSourceFile(fileName); - const redirect = find(sourceFilesToSearch, f => !!f.redirectInfo && f.redirectInfo.redirectTarget === redirectTarget)!; - fileName = redirect.fileName; - Debug.assert(sourceFilesSet.has(fileName)); + return undefined; } return { fileName, highlightSpans }; })); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index bec7d4b266d20..4df292dbc027a 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -2460,7 +2460,6 @@ export function createModuleSpecifierResolutionHost(program: Program, host: Lang getModuleSpecifierCache: maybeBind(host, host.getModuleSpecifierCache), getPackageJsonInfoCache: () => program.getModuleResolutionCache()?.getPackageJsonInfoCache(), getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation), - redirectTargetsMap: program.redirectTargetsMap, getRedirectFromSourceFile: fileName => program.getRedirectFromSourceFile(fileName), isSourceOfProjectReferenceRedirect: fileName => program.isSourceOfProjectReferenceRedirect(fileName), getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson), diff --git a/src/testRunner/unittests/helpers.ts b/src/testRunner/unittests/helpers.ts index 3821fbc285caa..c1ed9e24b7271 100644 --- a/src/testRunner/unittests/helpers.ts +++ b/src/testRunner/unittests/helpers.ts @@ -106,10 +106,7 @@ function createSourceFileWithText(fileName: string, sourceText: SourceText, targ export function createTestCompilerHost(texts: readonly NamedSourceText[], target: ts.ScriptTarget, oldProgram?: ProgramWithSourceTexts, useGetSourceFileByPath?: boolean, useCaseSensitiveFileNames?: boolean): TestCompilerHost { const files = ts.arrayToMap(texts, t => t.name, t => { if (oldProgram) { - let oldFile = oldProgram.getSourceFile(t.name) as SourceFileWithText; - if (oldFile && oldFile.redirectInfo) { - oldFile = oldFile.redirectInfo.unredirected; - } + const oldFile = oldProgram.getSourceFile(t.name) as SourceFileWithText; if (oldFile && oldFile.sourceText!.getVersion() === t.text.getVersion()) { return oldFile; } diff --git a/tests/baselines/reference/duplicatePackage.errors.txt b/tests/baselines/reference/duplicatePackage.errors.txt index 99d5a3f29ccf7..4e9b3720b6a35 100644 --- a/tests/baselines/reference/duplicatePackage.errors.txt +++ b/tests/baselines/reference/duplicatePackage.errors.txt @@ -1,3 +1,9 @@ +/node_modules/b/index.d.ts(1,15): error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module. +/node_modules/b/node_modules/x/index.d.ts(1,1): error TS1434: Unexpected keyword or identifier. +/node_modules/b/node_modules/x/index.d.ts(1,1): error TS2304: Cannot find name 'content'. +/node_modules/b/node_modules/x/index.d.ts(1,9): error TS1434: Unexpected keyword or identifier. +/node_modules/b/node_modules/x/index.d.ts(1,9): error TS2304: Cannot find name 'not'. +/node_modules/b/node_modules/x/index.d.ts(1,13): error TS2304: Cannot find name 'parsed'. /src/a.ts(5,3): error TS2345: Argument of type 'import("/node_modules/c/node_modules/x/index").default' is not assignable to parameter of type 'import("/node_modules/a/node_modules/x/index").default'. Types have separate declarations of a private property 'x'. @@ -24,12 +30,24 @@ ==== /node_modules/a/node_modules/x/package.json (0 errors) ==== { "name": "x", "version": "1.2.3" } -==== /node_modules/b/index.d.ts (0 errors) ==== +==== /node_modules/b/index.d.ts (1 errors) ==== import X from "x"; + ~~~ +!!! error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module. export const b: X; -==== /node_modules/b/node_modules/x/index.d.ts (0 errors) ==== +==== /node_modules/b/node_modules/x/index.d.ts (5 errors) ==== content not parsed + ~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~ +!!! error TS2304: Cannot find name 'content'. + ~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~ +!!! error TS2304: Cannot find name 'not'. + ~~~~~~ +!!! error TS2304: Cannot find name 'parsed'. ==== /node_modules/b/node_modules/x/package.json (0 errors) ==== { "name": "x", "version": "1.2.3" } diff --git a/tests/baselines/reference/duplicatePackage.symbols b/tests/baselines/reference/duplicatePackage.symbols index 0872054c3030b..b5fd703b49a9a 100644 --- a/tests/baselines/reference/duplicatePackage.symbols +++ b/tests/baselines/reference/duplicatePackage.symbols @@ -44,10 +44,8 @@ export const b: X; >X : Symbol(X, Decl(index.d.ts, 0, 6)) === /node_modules/b/node_modules/x/index.d.ts === -content not parsed ->X : Symbol(X, Decl(index.d.ts, 0, 0)) ->x : Symbol(X.x, Decl(index.d.ts, 0, 24)) +content not parsed === /node_modules/c/index.d.ts === import X from "x"; diff --git a/tests/baselines/reference/duplicatePackage.types b/tests/baselines/reference/duplicatePackage.types index 98226f14d7024..7d0376f8cb743 100644 --- a/tests/baselines/reference/duplicatePackage.types +++ b/tests/baselines/reference/duplicatePackage.types @@ -6,8 +6,8 @@ import { a } from "a"; > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ import { b } from "b"; ->b : import("/node_modules/a/node_modules/x/index").default -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>b : X +> : ^ import { c } from "c"; >c : import("/node_modules/c/node_modules/x/index").default @@ -18,8 +18,8 @@ a(b); // Works > : ^^^^ >a : (x: import("/node_modules/a/node_modules/x/index").default) => void > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ->b : import("/node_modules/a/node_modules/x/index").default -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>b : X +> : ^ a(c); // Error, these are from different versions of the library. >a(c) : void @@ -52,8 +52,8 @@ export default class X { === /node_modules/b/index.d.ts === import X from "x"; ->X : typeof X -> : ^^^^^^^^ +>X : any +> : ^^^ export const b: X; >b : X @@ -61,11 +61,12 @@ export const b: X; === /node_modules/b/node_modules/x/index.d.ts === content not parsed ->X : X -> : ^ - ->x : number -> : ^^^^^^ +>content : any +> : ^^^ +>not : any +> : ^^^ +>parsed : any +> : ^^^ === /node_modules/c/index.d.ts === import X from "x"; diff --git a/tests/baselines/reference/duplicatePackageServices.baseline.jsonc b/tests/baselines/reference/duplicatePackageServices.baseline.jsonc index 9983941171abf..21afa5bec8af8 100644 --- a/tests/baselines/reference/duplicatePackageServices.baseline.jsonc +++ b/tests/baselines/reference/duplicatePackageServices.baseline.jsonc @@ -8,10 +8,6 @@ // private x: number; // }|> -// === /node_modules/b/index.d.ts === -// <|import [|{| defId: 2, isWriteAccess: true |}X|] from "x";|> -// export const b: [|{| defId: 2 |}X|]; - // === Definitions === // === /node_modules/a/index.d.ts === // <|import [|{| defId: 0 |}X|]/*FIND ALL REFS*/ from "x";|> @@ -22,10 +18,6 @@ // private x: number; // }|> - // === /node_modules/b/index.d.ts === - // <|import [|{| defId: 2 |}X|] from "x";|> - // export const b: X; - // === Details === [ { @@ -101,59 +93,6 @@ "kind": "className" } ] - }, - { - "defId": 2, - "containerKind": "", - "containerName": "", - "kind": "alias", - "name": "(alias) class X\nimport X", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "alias", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "X", - "kind": "aliasName" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "import", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "X", - "kind": "aliasName" - } - ] } ] @@ -169,10 +108,6 @@ // <|import [|{| defId: 1, isWriteAccess: true |}X|] from "x";|> // export function a(x: [|{| defId: 1 |}X|]): void; -// === /node_modules/b/index.d.ts === -// <|import [|{| defId: 2, isWriteAccess: true |}X|] from "x";|> -// export const b: [|{| defId: 2 |}X|]; - // === Definitions === // === /node_modules/a/node_modules/x/index.d.ts === // <|export default class /*FIND ALL REFS*/[|{| defId: 0 |}X|] { @@ -183,10 +118,6 @@ // <|import [|{| defId: 1 |}X|] from "x";|> // export function a(x: X): void; - // === /node_modules/b/index.d.ts === - // <|import [|{| defId: 2 |}X|] from "x";|> - // export const b: X; - // === Details === [ { @@ -262,59 +193,6 @@ "kind": "aliasName" } ] - }, - { - "defId": 2, - "containerKind": "", - "containerName": "", - "kind": "alias", - "name": "(alias) class X\nimport X", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "alias", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "X", - "kind": "aliasName" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "import", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "X", - "kind": "aliasName" - } - ] } ] @@ -325,29 +203,21 @@ // <|import [|{| defId: 0, isWriteAccess: true, isDefinition: true |}X|]/*FIND ALL REFS*/ from "x";|> // export const b: [|{| defId: 0 |}X|]; -// === /node_modules/a/node_modules/x/index.d.ts === +// === /node_modules/b/node_modules/x/index.d.ts === // <|export default class [|{| defId: 1, isWriteAccess: true |}X|] { // private x: number; // }|> -// === /node_modules/a/index.d.ts === -// <|import [|{| defId: 2, isWriteAccess: true |}X|] from "x";|> -// export function a(x: [|{| defId: 2 |}X|]): void; - // === Definitions === // === /node_modules/b/index.d.ts === // <|import [|{| defId: 0 |}X|]/*FIND ALL REFS*/ from "x";|> // export const b: X; - // === /node_modules/a/node_modules/x/index.d.ts === + // === /node_modules/b/node_modules/x/index.d.ts === // <|export default class [|{| defId: 1 |}X|] { // private x: number; // }|> - // === /node_modules/a/index.d.ts === - // <|import [|{| defId: 2 |}X|] from "x";|> - // export function a(x: X): void; - // === Details === [ { @@ -423,59 +293,6 @@ "kind": "className" } ] - }, - { - "defId": 2, - "containerKind": "", - "containerName": "", - "kind": "alias", - "name": "(alias) class X\nimport X", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "alias", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "X", - "kind": "aliasName" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "import", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "X", - "kind": "aliasName" - } - ] } ] @@ -506,7 +323,7 @@ // === goToDefinition === -// === /node_modules/a/node_modules/x/index.d.ts === +// === /node_modules/b/node_modules/x/index.d.ts === // <|export default class [|X|] { // private x: number; // }|> @@ -520,7 +337,7 @@ { "kind": "class", "name": "X", - "containerName": "\"/node_modules/a/node_modules/x/index\"", + "containerName": "\"/node_modules/b/node_modules/x/index\"", "isLocal": false, "isAmbient": true, "unverified": false diff --git a/tests/baselines/reference/duplicatePackage_globalMerge.symbols b/tests/baselines/reference/duplicatePackage_globalMerge.symbols index 0b3ba9f899664..abc070a6090ee 100644 --- a/tests/baselines/reference/duplicatePackage_globalMerge.symbols +++ b/tests/baselines/reference/duplicatePackage_globalMerge.symbols @@ -23,8 +23,6 @@ export var y = 2 === /tests/node_modules/@types/react/index.d.ts === ->global : Symbol(global, Decl(index.d.ts, 0, 0)) - === /node_modules/@types/react/index.d.ts === declare global { } >global : Symbol(global, Decl(index.d.ts, 0, 0)) diff --git a/tests/baselines/reference/duplicatePackage_globalMerge.types b/tests/baselines/reference/duplicatePackage_globalMerge.types index 678ae6e110f31..6d2aa2b05cb83 100644 --- a/tests/baselines/reference/duplicatePackage_globalMerge.types +++ b/tests/baselines/reference/duplicatePackage_globalMerge.types @@ -33,9 +33,6 @@ export var y = 2 === /tests/node_modules/@types/react/index.d.ts === ->global : typeof global -> : ^^^^^^^^^^^^^ - === /node_modules/@types/react/index.d.ts === declare global { } >global : typeof global diff --git a/tests/baselines/reference/duplicatePackage_referenceTypes.errors.txt b/tests/baselines/reference/duplicatePackage_referenceTypes.errors.txt new file mode 100644 index 0000000000000..954f20ec44dc6 --- /dev/null +++ b/tests/baselines/reference/duplicatePackage_referenceTypes.errors.txt @@ -0,0 +1,30 @@ +/index.ts(4,5): error TS2322: Type 'import("/node_modules/a/node_modules/foo/index").Foo' is not assignable to type 'import("/node_modules/@types/foo/index").Foo'. + Types have separate declarations of a private property 'x'. + + +==== /index.ts (1 errors) ==== + import * as a from "a"; + import { Foo } from "foo"; + + let foo: Foo = a.foo; + ~~~ +!!! error TS2322: Type 'import("/node_modules/a/node_modules/foo/index").Foo' is not assignable to type 'import("/node_modules/@types/foo/index").Foo'. +!!! error TS2322: Types have separate declarations of a private property 'x'. + +==== /node_modules/a/index.d.ts (0 errors) ==== + /// + import { Foo } from "foo"; + export const foo: Foo; + +==== /node_modules/a/node_modules/foo/index.d.ts (0 errors) ==== + export class Foo { private x; } + +==== /node_modules/a/node_modules/foo/package.json (0 errors) ==== + { "name": "foo", "version": "1.2.3" } + +==== /node_modules/@types/foo/index.d.ts (0 errors) ==== + export class Foo { private x; } + +==== /node_modules/@types/foo/package.json (0 errors) ==== + { "name": "foo", "version": "1.2.3" } + \ No newline at end of file diff --git a/tests/baselines/reference/duplicatePackage_referenceTypes.types b/tests/baselines/reference/duplicatePackage_referenceTypes.types index cef2ff4080a93..c175773306230 100644 --- a/tests/baselines/reference/duplicatePackage_referenceTypes.types +++ b/tests/baselines/reference/duplicatePackage_referenceTypes.types @@ -12,12 +12,12 @@ import { Foo } from "foo"; let foo: Foo = a.foo; >foo : Foo > : ^^^ ->a.foo : Foo -> : ^^^ +>a.foo : import("/node_modules/a/node_modules/foo/index").Foo +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >a : typeof a > : ^^^^^^^^ ->foo : Foo -> : ^^^ +>foo : import("/node_modules/a/node_modules/foo/index").Foo +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ === /node_modules/a/index.d.ts === /// @@ -34,10 +34,12 @@ export class Foo { private x; } >Foo : Foo > : ^^^ >x : any +> : ^^^ === /node_modules/@types/foo/index.d.ts === export class Foo { private x; } >Foo : Foo > : ^^^ >x : any +> : ^^^ diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.errors.txt b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.errors.txt new file mode 100644 index 0000000000000..9f4f6d7f9bb1a --- /dev/null +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.errors.txt @@ -0,0 +1,43 @@ +/index.ts(4,5): error TS2345: Argument of type 'import("/node_modules/a/node_modules/foo/index").C' is not assignable to parameter of type 'import("/node_modules/foo/index").C'. + Types have separate declarations of a private property 'x'. + + +==== /index.ts (1 errors) ==== + import { use } from "foo/use"; + import { o } from "a"; + + use(o); + ~ +!!! error TS2345: Argument of type 'import("/node_modules/a/node_modules/foo/index").C' is not assignable to parameter of type 'import("/node_modules/foo/index").C'. +!!! error TS2345: Types have separate declarations of a private property 'x'. + +==== /node_modules/a/node_modules/foo/package.json (0 errors) ==== + { + "name": "foo", + "version": "1.2.3" + } + +==== /node_modules/a/node_modules/foo/index.d.ts (0 errors) ==== + export class C { + private x: number; + } + +==== /node_modules/a/index.d.ts (0 errors) ==== + import { C } from "foo"; + export const o: C; + +==== /node_modules/foo/use.d.ts (0 errors) ==== + import { C } from "./index"; + export function use(o: C): void; + +==== /node_modules/foo/index.d.ts (0 errors) ==== + export class C { + private x: number; + } + +==== /node_modules/foo/package.json (0 errors) ==== + { + "name": "foo", + "version": "1.2.3" + } + \ No newline at end of file diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types index d3ec5935c392f..7f763ae956638 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage.types @@ -6,16 +6,16 @@ import { use } from "foo/use"; > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ import { o } from "a"; ->o : import("/node_modules/foo/index").C -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>o : import("/node_modules/a/node_modules/foo/index").C +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use(o); >use(o) : void > : ^^^^ >use : (o: import("/node_modules/foo/index").C) => void > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ->o : import("/node_modules/foo/index").C -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>o : import("/node_modules/a/node_modules/foo/index").C +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ === /node_modules/a/node_modules/foo/index.d.ts === export class C { diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt new file mode 100644 index 0000000000000..19026366acc4c --- /dev/null +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.errors.txt @@ -0,0 +1,43 @@ +/index.ts(4,5): error TS2345: Argument of type 'import("/node_modules/a/node_modules/@foo/bar/index").C' is not assignable to parameter of type 'import("/node_modules/@foo/bar/index").C'. + Types have separate declarations of a private property 'x'. + + +==== /index.ts (1 errors) ==== + import { use } from "@foo/bar/use"; + import { o } from "a"; + + use(o); + ~ +!!! error TS2345: Argument of type 'import("/node_modules/a/node_modules/@foo/bar/index").C' is not assignable to parameter of type 'import("/node_modules/@foo/bar/index").C'. +!!! error TS2345: Types have separate declarations of a private property 'x'. + +==== /node_modules/a/node_modules/@foo/bar/package.json (0 errors) ==== + { + "name": "@foo/bar", + "version": "1.2.3" + } + +==== /node_modules/a/node_modules/@foo/bar/index.d.ts (0 errors) ==== + export class C { + private x: number; + } + +==== /node_modules/a/index.d.ts (0 errors) ==== + import { C } from "@foo/bar"; + export const o: C; + +==== /node_modules/@foo/bar/use.d.ts (0 errors) ==== + import { C } from "./index"; + export function use(o: C): void; + +==== /node_modules/@foo/bar/index.d.ts (0 errors) ==== + export class C { + private x: number; + } + +==== /node_modules/@foo/bar/package.json (0 errors) ==== + { + "name": "@foo/bar", + "version": "1.2.3" + } + \ No newline at end of file diff --git a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types index c78f42b4b1d3c..9d81f116ab8d9 100644 --- a/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types +++ b/tests/baselines/reference/duplicatePackage_relativeImportWithinPackage_scoped.types @@ -6,16 +6,16 @@ import { use } from "@foo/bar/use"; > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ import { o } from "a"; ->o : import("/node_modules/@foo/bar/index").C -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>o : import("/node_modules/a/node_modules/@foo/bar/index").C +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use(o); >use(o) : void > : ^^^^ >use : (o: import("/node_modules/@foo/bar/index").C) => void > : ^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ ->o : import("/node_modules/@foo/bar/index").C -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>o : import("/node_modules/a/node_modules/@foo/bar/index").C +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ === /node_modules/a/node_modules/@foo/bar/index.d.ts === export class C { diff --git a/tests/baselines/reference/duplicatePackage_subModule.errors.txt b/tests/baselines/reference/duplicatePackage_subModule.errors.txt new file mode 100644 index 0000000000000..a7412affa6794 --- /dev/null +++ b/tests/baselines/reference/duplicatePackage_subModule.errors.txt @@ -0,0 +1,33 @@ +/index.ts(4,7): error TS2322: Type 'import("/node_modules/a/node_modules/foo/Foo").default' is not assignable to type 'import("/node_modules/foo/Foo").default'. + Property 'source' is protected but type 'Foo' is not a class derived from 'Foo'. + + +==== /index.ts (1 errors) ==== + import Foo from "foo/Foo"; + import * as a from "a"; + + const o: Foo = a.o; + ~ +!!! error TS2322: Type 'import("/node_modules/a/node_modules/foo/Foo").default' is not assignable to type 'import("/node_modules/foo/Foo").default'. +!!! error TS2322: Property 'source' is protected but type 'Foo' is not a class derived from 'Foo'. + +==== /node_modules/a/index.d.ts (0 errors) ==== + import Foo from "foo/Foo"; + export const o: Foo; + +==== /node_modules/a/node_modules/foo/Foo.d.ts (0 errors) ==== + export default class Foo { + protected source: boolean; + } + +==== /node_modules/a/node_modules/foo/package.json (0 errors) ==== + { "name": "foo", "version": "1.2.3" } + +==== /node_modules/foo/Foo.d.ts (0 errors) ==== + export default class Foo { + protected source: boolean; + } + +==== /node_modules/foo/package.json (0 errors) ==== + { "name": "foo", "version": "1.2.3" } + \ No newline at end of file diff --git a/tests/baselines/reference/duplicatePackage_subModule.types b/tests/baselines/reference/duplicatePackage_subModule.types index f239c37d53ea5..b50456a811da4 100644 --- a/tests/baselines/reference/duplicatePackage_subModule.types +++ b/tests/baselines/reference/duplicatePackage_subModule.types @@ -12,12 +12,12 @@ import * as a from "a"; const o: Foo = a.o; >o : Foo > : ^^^ ->a.o : Foo -> : ^^^ +>a.o : import("/node_modules/a/node_modules/foo/Foo").default +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >a : typeof a > : ^^^^^^^^ ->o : Foo -> : ^^^ +>o : import("/node_modules/a/node_modules/foo/Foo").default +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ === /node_modules/a/index.d.ts === import Foo from "foo/Foo"; diff --git a/tests/baselines/reference/duplicatePackage_withErrors.errors.txt b/tests/baselines/reference/duplicatePackage_withErrors.errors.txt index 89cc598606f42..090ca51dd3367 100644 --- a/tests/baselines/reference/duplicatePackage_withErrors.errors.txt +++ b/tests/baselines/reference/duplicatePackage_withErrors.errors.txt @@ -1,4 +1,10 @@ /node_modules/a/node_modules/x/index.d.ts(1,18): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference. +/node_modules/b/index.d.ts(1,19): error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module. +/node_modules/b/node_modules/x/index.d.ts(1,1): error TS1434: Unexpected keyword or identifier. +/node_modules/b/node_modules/x/index.d.ts(1,1): error TS2304: Cannot find name 'content'. +/node_modules/b/node_modules/x/index.d.ts(1,9): error TS1434: Unexpected keyword or identifier. +/node_modules/b/node_modules/x/index.d.ts(1,9): error TS2304: Cannot find name 'not'. +/node_modules/b/node_modules/x/index.d.ts(1,13): error TS2304: Cannot find name 'parsed'. ==== /src/a.ts (0 errors) ==== @@ -16,11 +22,23 @@ ==== /node_modules/a/node_modules/x/package.json (0 errors) ==== { "name": "x", "version": "1.2.3" } -==== /node_modules/b/index.d.ts (0 errors) ==== +==== /node_modules/b/index.d.ts (1 errors) ==== export { x } from "x"; + ~~~ +!!! error TS2306: File '/node_modules/b/node_modules/x/index.d.ts' is not a module. -==== /node_modules/b/node_modules/x/index.d.ts (0 errors) ==== +==== /node_modules/b/node_modules/x/index.d.ts (5 errors) ==== content not parsed + ~~~~~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~~~~~ +!!! error TS2304: Cannot find name 'content'. + ~~~ +!!! error TS1434: Unexpected keyword or identifier. + ~~~ +!!! error TS2304: Cannot find name 'not'. + ~~~~~~ +!!! error TS2304: Cannot find name 'parsed'. ==== /node_modules/b/node_modules/x/package.json (0 errors) ==== { "name": "x", "version": "1.2.3" } diff --git a/tests/baselines/reference/duplicatePackage_withErrors.symbols b/tests/baselines/reference/duplicatePackage_withErrors.symbols index 76a9124077b8e..a8df9c4b12851 100644 --- a/tests/baselines/reference/duplicatePackage_withErrors.symbols +++ b/tests/baselines/reference/duplicatePackage_withErrors.symbols @@ -22,6 +22,6 @@ export { x } from "x"; >x : Symbol(x, Decl(index.d.ts, 0, 8)) === /node_modules/b/node_modules/x/index.d.ts === + content not parsed ->x : Symbol(x, Decl(index.d.ts, 0, 12)) diff --git a/tests/baselines/reference/duplicatePackage_withErrors.types b/tests/baselines/reference/duplicatePackage_withErrors.types index f4d6c74294dc1..e4588e0a4f9ad 100644 --- a/tests/baselines/reference/duplicatePackage_withErrors.types +++ b/tests/baselines/reference/duplicatePackage_withErrors.types @@ -8,10 +8,10 @@ import { x as xa } from "a"; > : ^^^^^^ import { x as xb } from "b"; ->x : number -> : ^^^^^^ ->xb : number -> : ^^^^^^ +>x : any +> : ^^^ +>xb : any +> : ^^^ === /node_modules/a/index.d.ts === export { x } from "x"; @@ -31,17 +31,15 @@ export const x = 1 + 1; === /node_modules/b/index.d.ts === export { x } from "x"; ->x : number -> : ^^^^^^ +>x : any +> : ^^^ === /node_modules/b/node_modules/x/index.d.ts === content not parsed ->x : number -> : ^^^^^^ ->1 + 1 : number -> : ^^^^^^ ->1 : 1 -> : ^ ->1 : 1 -> : ^ +>content : any +> : ^^^ +>not : any +> : ^^^ +>parsed : any +> : ^^^ diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js b/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js index 5e0bc2efaf3d0..a3444dfdeea1a 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-no-change.js @@ -108,6 +108,8 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js b/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js index e5512f595c5da..fe309f6dc1ff0 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-previous-duplicate-packages.js @@ -114,7 +114,7 @@ home/src/workspaces/project/node_modules/b/node_modules/x/index.d.ts(3,16): erro -Program 2 Reused:: Not +Program 2 Reused:: Completely File: /home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts @@ -167,7 +167,7 @@ x: { "packageId": { "name": "x", "subModuleName": "index.d.ts", - "version": "1.2.3" + "version": "1.2.4" }, "resolvedUsingTsExtension": false }, @@ -224,5 +224,7 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js index 76f3b7f633545..ebd7f080f4f5c 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-target-changes.js @@ -108,10 +108,12 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. -Program 2 Reused:: Not +Program 2 Reused:: Completely File: /home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts @@ -127,6 +129,11 @@ x: { "resolvedFileName": "/home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts", "extension": ".d.ts", "isExternalLibraryImport": true, + "packageId": { + "name": "x", + "subModuleName": "index.d.ts", + "version": "1.2.3" + }, "resolvedUsingTsExtension": false }, "failedLookupLocations": [ diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js index 8a9b9173d47eb..4144be4327ac4 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-underlying-changes.js @@ -108,10 +108,12 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. -Program 2 Reused:: Not +Program 2 Reused:: Completely File: /home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts @@ -164,7 +166,7 @@ x: { "packageId": { "name": "x", "subModuleName": "index.d.ts", - "version": "1.2.4" + "version": "1.2.3" }, "resolvedUsingTsExtension": false }, diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js index 5e0bc2efaf3d0..a3444dfdeea1a 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-no-change.js @@ -108,6 +108,8 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js index e5512f595c5da..fe309f6dc1ff0 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-previous-duplicate-packages.js @@ -114,7 +114,7 @@ home/src/workspaces/project/node_modules/b/node_modules/x/index.d.ts(3,16): erro -Program 2 Reused:: Not +Program 2 Reused:: Completely File: /home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts @@ -167,7 +167,7 @@ x: { "packageId": { "name": "x", "subModuleName": "index.d.ts", - "version": "1.2.3" + "version": "1.2.4" }, "resolvedUsingTsExtension": false }, @@ -224,5 +224,7 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js index 76f3b7f633545..ebd7f080f4f5c 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-target-changes.js @@ -108,10 +108,12 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. -Program 2 Reused:: Not +Program 2 Reused:: Completely File: /home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts @@ -127,6 +129,11 @@ x: { "resolvedFileName": "/home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts", "extension": ".d.ts", "isExternalLibraryImport": true, + "packageId": { + "name": "x", + "subModuleName": "index.d.ts", + "version": "1.2.3" + }, "resolvedUsingTsExtension": false }, "failedLookupLocations": [ diff --git a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js index 8a9b9173d47eb..4144be4327ac4 100644 --- a/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js +++ b/tests/baselines/reference/reuseProgramStructure/redirect-with-getSourceFileByPath-underlying-changes.js @@ -108,10 +108,12 @@ b: { MissingPaths:: [] +home/src/workspaces/project/a.ts(3,3): error TS2345: Argument of type 'import("/home/src/workspaces/project/node_modules/b/node_modules/x/index").default' is not assignable to parameter of type 'import("/home/src/workspaces/project/node_modules/a/node_modules/x/index").default'. + Types have separate declarations of a private property 'x'. -Program 2 Reused:: Not +Program 2 Reused:: Completely File: /home/src/workspaces/project/node_modules/a/node_modules/x/index.d.ts @@ -164,7 +166,7 @@ x: { "packageId": { "name": "x", "subModuleName": "index.d.ts", - "version": "1.2.4" + "version": "1.2.3" }, "resolvedUsingTsExtension": false }, diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js index 1af32b139b2d7..ce76116a2486b 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-moduleCaseChange.js @@ -182,7 +182,6 @@ plugin-one/action.ts Matched by default include pattern '**/*' plugin-two/node_modules/typescript-fsa/index.d.ts Imported via "typescript-fsa" from file 'plugin-two/index.d.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' - File redirects to file 'plugin-one/node_modules/typescript-fsa/index.d.ts' plugin-two/index.d.ts Imported via "plugin-two" from file 'plugin-one/index.ts' plugin-one/index.ts diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js index f4ad9030bc4a9..2e74cdb416c3e 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link-moduleCaseChange.js @@ -194,7 +194,6 @@ plugin-two/dist/commonjs/index.d.ts Imported via "plugin-two" from file 'plugin-one/index.ts' with packageId 'plugin-two/dist/commonjs/index.d.ts@0.1.3' plugin-one/node_modules/typescript-fsa/index.d.ts Imported via "typescript-fsa" from file 'plugin-one/index.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' - File redirects to file 'plugin-two/node_modules/typescript-fsa/index.d.ts' plugin-one/index.ts Matched by default include pattern '**/*' diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js index 68271055761d0..dd278822a7a1e 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package-with-indirect-link.js @@ -194,7 +194,6 @@ plugin-two/dist/commonjs/index.d.ts Imported via "plugin-two" from file 'plugin-one/index.ts' with packageId 'plugin-two/dist/commonjs/index.d.ts@0.1.3' plugin-one/node_modules/typescript-fsa/index.d.ts Imported via "typescript-fsa" from file 'plugin-one/index.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' - File redirects to file 'plugin-two/node_modules/typescript-fsa/index.d.ts' plugin-one/index.ts Matched by default include pattern '**/*' diff --git a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js index 25a4fc22117ac..cce060226f34f 100644 --- a/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js +++ b/tests/baselines/reference/tsc/declarationEmit/when-same-version-is-referenced-through-source-and-another-symlinked-package.js @@ -182,7 +182,6 @@ plugin-one/action.ts Matched by default include pattern '**/*' plugin-two/node_modules/typescript-fsa/index.d.ts Imported via "typescript-fsa" from file 'plugin-two/index.d.ts' with packageId 'typescript-fsa/index.d.ts@3.0.0-beta-2' - File redirects to file 'plugin-one/node_modules/typescript-fsa/index.d.ts' plugin-two/index.d.ts Imported via "plugin-two" from file 'plugin-one/index.ts' plugin-one/index.ts diff --git a/tests/baselines/reference/tsserver/completions/works-when-files-are-included-from-two-different-drives-of-windows.js b/tests/baselines/reference/tsserver/completions/works-when-files-are-included-from-two-different-drives-of-windows.js index 16f0540db5140..cf141c21be0bb 100644 --- a/tests/baselines/reference/tsserver/completions/works-when-files-are-included-from-two-different-drives-of-windows.js +++ b/tests/baselines/reference/tsserver/completions/works-when-files-are-included-from-two-different-drives-of-windows.js @@ -191,7 +191,6 @@ Info seq [hh:mm:ss:mss] Files (6) Entry point for implicit type library 'react' with packageId '@types/react/index.d.ts@16.9.14' c:/typescript/node_modules/@types/react/index.d.ts Imported via 'react' from file 'c:/typescript/node_modules/@types/react-router-dom/index.d.ts' with packageId '@types/react/index.d.ts@16.9.14' - File redirects to file '../node_modules/@types/react/index.d.ts' c:/typescript/node_modules/@types/react-router-dom/index.d.ts Imported via "react-router-dom" from file 'app.js' with packageId '@types/react-router-dom/index.d.ts@5.1.2' app.js @@ -305,17 +304,21 @@ TI:: [hh:mm:ss:mss] Got install request "include": [], "exclude": [] }, - "unresolvedImports": [], + "unresolvedImports": [ + "prop-types" + ], "projectRootPath": "e:/solution/myproject/src", "kind": "discover" } TI:: [hh:mm:ss:mss] Failed to load safelist from types map file '/home/src/tslibs/TS/Lib/typesMap.json' TI:: [hh:mm:ss:mss] Explicitly included types: [] -TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: [] +TI:: [hh:mm:ss:mss] Inferred typings from unresolved imports: ["prop-types"] TI:: [hh:mm:ss:mss] Finished typings discovery: { "cachedTypingPaths": [], - "newTypingNames": [], + "newTypingNames": [ + "prop-types" + ], "filesToWatch": [ "e:/solution/myproject/src/bower_components", "e:/solution/myproject/src/node_modules" @@ -334,6 +337,9 @@ Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: e:/solution/mypro Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: e:/solution/myproject/src/bower_components 1 undefined Project: /dev/null/inferredProject1* WatchType: Directory location for typing installer Info seq [hh:mm:ss:mss] DirectoryWatcher:: Added:: WatchInfo: e:/solution/myproject/src/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Directory location for typing installer Info seq [hh:mm:ss:mss] Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: e:/solution/myproject/src/node_modules 1 undefined Project: /dev/null/inferredProject1* WatchType: Directory location for typing installer +TI:: [hh:mm:ss:mss] Installing typings ["prop-types"] +TI:: [hh:mm:ss:mss] 'prop-types':: Entry for package 'prop-types' does not exist in local types registry - skipping... +TI:: [hh:mm:ss:mss] All typings are known to be missing or invalid - no need to install more typings TI:: [hh:mm:ss:mss] Sending response: { "projectName": "/dev/null/inferredProject1*", @@ -351,7 +357,9 @@ TI:: [hh:mm:ss:mss] Sending response: "maxNodeModuleJsDepth": 2 }, "typings": [], - "unresolvedImports": [], + "unresolvedImports": [ + "prop-types" + ], "kind": "action::set" } Info seq [hh:mm:ss:mss] event: @@ -375,11 +383,12 @@ Info seq [hh:mm:ss:mss] event: "maxNodeModuleJsDepth": 2 }, "typings": [], - "unresolvedImports": [], + "unresolvedImports": [ + "prop-types" + ], "kind": "action::set" } } -TI:: [hh:mm:ss:mss] No new typings were requested as a result of typings discovery Info seq [hh:mm:ss:mss] FileWatcher:: Added:: WatchInfo: e:/solution/myproject/package.json 250 undefined WatchType: package.json file Info seq [hh:mm:ss:mss] Project '/dev/null/inferredProject1*' (Inferred) Info seq [hh:mm:ss:mss] Files (6) diff --git a/tests/baselines/reference/tsserver/duplicatePackages/works-with-import-fixes.js b/tests/baselines/reference/tsserver/duplicatePackages/works-with-import-fixes.js index 6f8e6592fd5e3..fa4dbc050e170 100644 --- a/tests/baselines/reference/tsserver/duplicatePackages/works-with-import-fixes.js +++ b/tests/baselines/reference/tsserver/duplicatePackages/works-with-import-fixes.js @@ -119,7 +119,6 @@ Info seq [hh:mm:ss:mss] Files (5) Matched by default include pattern '**/*' b/node_modules/foo/index.d.ts Imported via "foo" from file 'b/user.ts' with packageId 'foo/index.d.ts@1.2.3' - File redirects to file 'a/node_modules/foo/index.d.ts' b/user.ts Matched by default include pattern '**/*' diff --git a/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard3.js b/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard3.js index d781a9725159a..4853122a820e8 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard3.js +++ b/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard3.js @@ -153,7 +153,7 @@ Info seq [hh:mm:ss:mss] event: "category": "error" }, { - "text": "File '/home/src/workspaces/project/nope.ts' is not under 'rootDir' '/home/src/workspaces/project/src'. 'rootDir' is expected to contain all source files.\n The file is in the program because:\n Matched by default include pattern '**/*'\n File is CommonJS module because '/home/src/workspaces/project/package.json' does not have field \"type\"", + "text": "File '/home/src/workspaces/project/nope.ts' is not under 'rootDir' '/home/src/workspaces/project/src'. 'rootDir' is expected to contain all source files.\n The file is in the program because:\n Matched by default include pattern '**/*'", "code": 6059, "category": "error" }, diff --git a/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard4.js b/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard4.js index 2d30bc322561e..2d98460424d12 100644 --- a/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard4.js +++ b/tests/baselines/reference/tsserver/fourslashServer/pathCompletionsPackageJsonImportsSrcNoDistWildcard4.js @@ -160,7 +160,7 @@ Info seq [hh:mm:ss:mss] event: "category": "error" }, { - "text": "File '/home/src/workspaces/project/nope.ts' is not under 'rootDir' '/home/src/workspaces/project/src'. 'rootDir' is expected to contain all source files.\n The file is in the program because:\n Matched by default include pattern '**/*'\n File is CommonJS module because '/home/src/workspaces/project/package.json' does not have field \"type\"", + "text": "File '/home/src/workspaces/project/nope.ts' is not under 'rootDir' '/home/src/workspaces/project/src'. 'rootDir' is expected to contain all source files.\n The file is in the program because:\n Matched by default include pattern '**/*'", "code": 6059, "category": "error" }, diff --git a/tests/cases/fourslash/duplicatePackageServices.ts b/tests/cases/fourslash/duplicatePackageServices.ts index d80ec40b82beb..f3ee6d1b9b856 100644 --- a/tests/cases/fourslash/duplicatePackageServices.ts +++ b/tests/cases/fourslash/duplicatePackageServices.ts @@ -31,6 +31,6 @@ ////a(/*error*/b); goTo.file("/src/a.ts"); -verify.numberOfErrorsInCurrentFile(0); +verify.numberOfErrorsInCurrentFile(1); verify.baselineFindAllReferences('useAX', 'defAX', 'useBX'); verify.baselineGoToDefinition("useAX", "useBX"); diff --git a/tests/cases/fourslash/duplicatePackageServices_fileChanges.ts b/tests/cases/fourslash/duplicatePackageServices_fileChanges.ts index 203277d7ad467..c5f2003d422ab 100644 --- a/tests/cases/fourslash/duplicatePackageServices_fileChanges.ts +++ b/tests/cases/fourslash/duplicatePackageServices_fileChanges.ts @@ -31,7 +31,7 @@ ////a(/*error*/b); goTo.file("/src/a.ts"); -verify.numberOfErrorsInCurrentFile(0); +verify.numberOfErrorsInCurrentFile(1); testChangeAndChangeBack("aVersionPatch", "defAX"); testChangeAndChangeBack("bVersionPatch", "defBX"); @@ -53,5 +53,5 @@ function testChangeAndChangeBack(versionPatch: string, def: string) { // Back to being identical. goTo.file("/src/a.ts"); - verify.numberOfErrorsInCurrentFile(0); + verify.numberOfErrorsInCurrentFile(1); }