Skip to content

Conversation

@bakkot
Copy link
Contributor

@bakkot bakkot commented Oct 6, 2025

Fixes #60397.

error TS5096 currently says

Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.

But in fact rewriteRelativeImportExtensions also works (as you can see from the line above the change in src/compiler/program.ts in this PR), and is often what I at least am reaching for. This PR updates it to read

Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set.

Copilot AI review requested due to automatic review settings October 6, 2025 23:27
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Oct 6, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Oct 6, 2025
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 PR updates the error message for the allowImportingTsExtensions compiler option to accurately reflect all valid configurations. The error now mentions that rewriteRelativeImportExtensions is also a valid option alongside noEmit and emitDeclarationOnly.

  • Updates the diagnostic message text to include rewriteRelativeImportExtensions as a third valid option
  • Updates the corresponding diagnostic key in the messages file
  • Updates test baselines to reflect the new error message

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/compiler/program.ts Updated diagnostic key reference to use the new message
src/compiler/diagnosticMessages.json Updated error message text to include rewriteRelativeImportExtensions
tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt Updated test baseline to reflect new error message

@github-project-automation github-project-automation bot moved this from Not started to Needs merge in PR Backlog Oct 13, 2025
@bakkot
Copy link
Contributor Author

bakkot commented Nov 14, 2025

friendly ping, anything more I need to do here?

@jakebailey jakebailey merged commit cc2610f into microsoft:main Nov 14, 2025
33 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Nov 14, 2025
@bakkot bakkot deleted the fix-allow-import-ts-extn-error branch November 14, 2025 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

The error for allowImportingTsExtensions does not reference rewriteRelativeImportExtensions

4 participants