Port TS PR #62418: Add diagnostic when rootDir inference changes output layout#2819
Draft
Port TS PR #62418: Add diagnostic when rootDir inference changes output layout#2819
Conversation
…n directory Add diagnostic 5011 to warn when rootDir inference changes output layout. Export GetComputedCommonSourceDirectory from outputpaths package. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Port assume rootDir is the current configuration directory
Port TS PR #62418: Add diagnostic when rootDir inference changes output layout
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the missing piece from microsoft/TypeScript#62418. The core behavioral change (
getCommonSourceDirectoryusingconfigFilePathwithout requiringcomposite) was already ported. What was missing is the helpful TS5011 diagnostic that warns users when their inferred rootDir differs from what the computed common source directory would produce.Changes
outputpaths/commonsourcedirectory.go: ExportGetComputedCommonSourceDirectory— computes common source directory from actual emitted filenames without considering config file pathcompiler/program.go: Add diagnostic check inverifyCompilerOptions()— when!noEmit && !composite && !rootDir && configFilePath && (outDir || declarationDir || outFile), compare config-inferred dir against file-computed dir and emit TS5011 with migration link if they differBaseline changes
commonSourceDirectory_dts.errors.txt.diffdeleted (Go now matches TS output)commonSourceDirectory.js.diffanddeclarationEmitToDeclarationDirWithDeclarationOption.js.diffreduced (DtsFileErrors section now produced; remaining diff is pre-existing test harness formatting difference)💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.