Skip to content

Update error for allowImportingTsExtensions to mention rewriteRelativeImportExtensions - #62557

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
bakkot:fix-allow-import-ts-extn-error
Nov 14, 2025
Merged

Update error for allowImportingTsExtensions to mention rewriteRelativeImportExtensions#62557
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
bakkot:fix-allow-import-ts-extn-error

Conversation

@bakkot

Copy link
Copy Markdown
Contributor

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.

CopilotAI review requested due to automatic review settings October 6, 2025 23:27
@github-project-automationgithub-project-automationBot moved this to Not started in PR BacklogOct 6, 2025
@typescript-botTypeScript Bot (typescript-bot) added the For Backlog Bug PRs that fix a backlog bug label Oct 6, 2025

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

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.

FileDescription
src/compiler/program.tsUpdated diagnostic key reference to use the new message
src/compiler/diagnosticMessages.jsonUpdated error message text to include rewriteRelativeImportExtensions
tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txtUpdated test baseline to reflect new error message

@github-project-automationgithub-project-automationBot moved this from Not started to Needs merge in PR BacklogOct 13, 2025
@bakkot

Copy link
Copy Markdown
ContributorAuthor

friendly ping, anything more I need to do here?

@jakebailey
Jake Bailey (jakebailey) merged commit cc2610f into microsoft:mainNov 14, 2025
33 checks passed
@github-project-automationgithub-project-automationBot moved this from Needs merge to Done in PR BacklogNov 14, 2025
@bakkot
Kevin Gibbons (bakkot) deleted the fix-allow-import-ts-extn-error branch November 14, 2025 17:14
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators May 14, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog BugPRs 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

5 participants

@bakkot@andrewbranch@jakebailey@typescript-bot