Skip to content

Port TS PR #62418: Add diagnostic when rootDir inference changes output layout#2819

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/port-config-directory-assumption
Draft

Port TS PR #62418: Add diagnostic when rootDir inference changes output layout#2819
Copilot wants to merge 2 commits intomainfrom
copilot/port-config-directory-assumption

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

Ports the missing piece from microsoft/TypeScript#62418. The core behavioral change (getCommonSourceDirectory using configFilePath without requiring composite) 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: Export GetComputedCommonSourceDirectory — computes common source directory from actual emitted filenames without considering config file path
  • compiler/program.go: Add diagnostic check in verifyCompilerOptions() — when !noEmit && !composite && !rootDir && configFilePath && (outDir || declarationDir || outFile), compare config-inferred dir against file-computed dir and emit TS5011 with migration link if they differ

Baseline changes

  • commonSourceDirectory_dts.errors.txt.diff deleted (Go now matches TS output)
  • commonSourceDirectory.js.diff and declarationEmitToDeclarationDirWithDeclarationOption.js.diff reduced (DtsFileErrors section now produced; remaining diff is pre-existing test harness formatting difference)
  • Multiple tsbuild/tsc baselines updated to reflect new diagnostic

💡 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.

…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
Copilot AI requested a review from jakebailey February 18, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants