Skip to content

Conversation

@sheetalkamat
Copy link
Member

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements support for explaining redirect/deduplicated files in the --explainFiles compiler output. When the same package (same name@version) is installed in multiple node_modules locations due to symlinks or other reasons, TypeScript deduplicates them by redirecting to a canonical instance. This PR ensures these redirect files are properly explained in the output.

Changes:

  • Added redirectsFile type to track redirect files with their insertion position for proper ordering
  • Modified ExplainFiles to interleave redirect files with source files in the correct order based on their indices
  • Updated explainRedirectAndImpliedFormat to handle both source files and redirect files, generating appropriate diagnostic messages
  • Removed unused fileIncludeKind constants and replaced deduplicatedPaths tracking with more precise redirectFilesByPath map

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/compiler/program.go Updated UpdateProgram to check redirect files early, modified ExplainFiles to interleave redirect and source files, updated HasSameFileNames to compare redirect files
internal/compiler/processingDiagnostic.go Changed explainRedirectAndImpliedFormat signature to accept filePath instead of *ast.SourceFile
internal/compiler/includeprocessor.go Enhanced explainRedirectAndImpliedFormat to handle redirect files and generate redirect diagnostic messages
internal/compiler/filesparser.go Added logic to create redirectsFile entries when duplicates are detected, adjusted indices for proper ordering
internal/compiler/fileloader.go Added redirectsFile type and replaced deduplicatedPaths with redirectFilesByPath in processedFiles
internal/compiler/fileInclude.go Removed unused fileIncludeKindSourceFromProjectReference and fileIncludeKindOutputFromProjectReference constants and related code
internal/execute/tsctests/tsc_test.go Removed TODO comments for now-implemented features
testdata/baselines/reference/tsc/declarationEmit/*.js Updated test baselines to include redirect file explanations

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.

3 participants