Skip to content

Clarify error when content mapper extension ends in a built-in extension - #64921

Open
GOVARDHAN CHINTA (govardhanchinta99) wants to merge 2 commits into
microsoft:mainfrom
govardhanchinta99:fix-64917-content-mapper-message
Open

GOVARDHAN CHINTA (govardhanchinta99) wants to merge 2 commits into
microsoft:mainfrom
govardhanchinta99:fix-64917-content-mapper-message

Conversation

@govardhanchinta99

@govardhanchinta99 GOVARDHAN CHINTA (govardhanchinta99) commented Oct 22, 2026 •

Copy link
Copy Markdown

Fixes #64917

A content mapper extension is rejected when it ends in a built-in extension (HasReservedSourceExtension does a suffix check). For .const.json the error said it "is a built-in extension", which is misleading, because .const.json is not built-in, it is rejected because it ends in .json.

This changes the message for TS18066 to: "Content mapper file extension '{0}' cannot be registered because it ends in a built-in extension." The error code and the check itself are unchanged. I did not add support for .const.json-style extensions, since that looks like a design decision for the team.

Changes:

  • Reworded the message in diagnosticMessages.json
  • Regenerated the dependent files with npx hereby generate:diagnostics
  • Updated the renamed diagnostic variable in tsconfigparsing.go and its tests

Testing: the tsoptions package and the compiler test runner (internal/testrunner) pass, and hereby check:format is clean.

cc Andrew Branch (@andrewbranch), you worked on content mappers, so I'd appreciate your view on whether this wording works.

Copilot AI balanced review requested due to automatic review settings October 22, 2026 11:21
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 22, 2026
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 22, 2026

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@govardhanchinta99

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think the .json.gz files are supposed to be updated.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for catching that. I removed all of the loc/*.json.gz changes in the latest commit, they are back to what main has. The PR now only touches the diagnostic message, the generated Go and JSON files for it, and the tsoptions code and tests.

The loc/*.json.gz files are produced by the localization pipeline and should not be updated in this PR. Restore them to the versions on main.
"Private_identifiers_cannot_be_used_in_destructuring_patterns_18064": "Private identifiers cannot be used in destructuring patterns.",
"Content_mapper_file_extension_0_must_begin_with_a_18065": "Content mapper file extension '{0}' must begin with a '.'.",
"Content_mapper_file_extension_0_is_a_built_in_extension_and_cannot_be_registered_by_a_content_mapper_18066": "Content mapper file extension '{0}' is a built-in extension and cannot be registered by a content mapper.",
"Content_mapper_file_extension_0_cannot_be_registered_because_it_ends_in_a_built_in_extension_18066": "Content mapper file extension '{0}' cannot be registered because it ends in a built-in extension.",

@DetachHead DetachHead Oct 26, 2026 •

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.

can we support .const.json and other similar extensions instead? as i suggested in my issue (#64917):

my preferred solution is that patterns like .const.json should be supported, to support content mappers like const-json-content-mapper

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. Allowing .const.json would reverse a deliberate rule: commit made content mapper extensions that end in a built-in extension invalid, and compound extensions are still allowed as long as they don't end in one. That looks like a decision for the maintainers, so this PR only fixes the misleading wording. If the team would prefer to allow it, I'm happy to rework this PR.

@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense to me, thanks!

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Oct 28, 2026

This branch has not been deployed

No deployments
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: Needs merge

Development

Successfully merging this pull request may close these issues.

"Content mapper file extension '.const.json' is a built-in extension and cannot be registered by a content mapper." error is misleading

5 participants