Repository navigation
Fix tsc --showConfig failing with TS18068 when tsconfig has contentMappers - #65831
MIA_Ether (mia03ther) wants to merge 1 commit into
Conversation
…Mappers `--showConfig` only displays the resolved config and never runs content mapper code, so the "content mappers require --runExternalCode" error does not apply to it. Filter that diagnostic out of the config errors checked by the --showConfig path; all other config errors still fail the command, and normal compilation still requires --runExternalCode for content mappers. Fixes microsoft#65795
|
MIA_Ether (@mia03ther) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
1 similar comment
|
MIA_Ether (@mia03ther) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
Config parsing discards mapped .vue inputs before --showConfig filtering, causing TS18003 for mapped-only projects and incomplete file lists for mixed projects.
1 open issue
What changed in this PR
Addresses #65795 by ignoring TS18068 when displaying configuration, while preserving the content-mapper execution requirement for compilation.
Changes:
- Filters TS18068 from
--showConfigerrors. - Adds a regression test and expected-output baseline.
| File | Description |
|---|---|
tsc/testdata/baselines/reference/tsc/showConfig/Show-TSConfig-with-contentMappers.js |
Records successful configuration output. |
tsc/internal/execute/tsctests/showconfig_test.go |
Tests --showConfig with contentMappers. |
tsc/internal/execute/tsc.go |
Filters the execution-permission diagnostic during config display. |
Review effort: Balanced
| if e.Code() != diagnostics.Content_mappers_require_the_runExternalCode_command_line_flag_to_be_enabled.Code() { | ||
| remainingErrors = append(remainingErrors, e) |

Fixes #65795
tsc --showConfigexits 1 with TS18068 whentsconfig.jsonhascontentMappersand--runExternalCodeis not set, even though--showConfignever runs content mapper code (per tsc Security Properties,--runExternalCodeguards running mapper code). This is a regression vs 7.1.0-beta.Fix (
tsc/internal/execute/tsc.go): in the--showConfigpath, filter theContent_mappers_require_the_runExternalCode_command_line_flag_to_be_enableddiagnostic out of the config errors before deciding whether to fail. All other config errors still fail the command, and normal compilation still requires--runExternalCodefor content mappers (the diagnostic is still emitted during config parsing; it is only ignored when displaying the config).Test (
tsc/internal/execute/tsctests/showconfig_test.go+ new baselineShow-TSConfig-with-contentMappers.js):--showConfigon a project whose tsconfig hascontentMappers: [{ "package": "some-mapper" }]now prints the resolved config ("files": ["./a.ts"]) and exits 0.Note on verification: I could not run the Go test suite locally (no Go toolchain in this environment), so the new baseline was written by hand following the existing
showConfigbaselines; please let CI verify it.