Fix --customConditions null not being respected when overriding tsconfig.json
- [x] Add parameter to pass raw command line options through config parsing functions
- [x] Update mergeCompilerOptions to use raw command line options
- [x] Update all call sites of ParseJsonSourceFileConfigFilePath
- [x] Add test for --customConditions null override
- [x] Run existing tests to ensure no regressions
- [x] Verify fix works as expected with manual testing
- [x] Fix nil targetOptions by initializing in parseConfig instead of workaround in mergeCompilerOptions
- [x] Eliminate WithRaw functions, add raw parameter to existing functions
- [x] Run formatter
- [x] Wrap command line options in compilerOptions key to simplify mergeCompilerOptions
Original prompt
This section details on the original issue you should resolve
<issue_title>Passing --customConditions null it not respected</issue_title> <issue_description>## Steps to reproduce I don't have a repo, but I can create it if mandatory
Behavior with
[email protected]running
tsc --customConditions nulloverrides the customConditions and sets it to nullBehavior with
tsgorunning
tsgo --customConditions nulldoes not override customConditions and uses the customConditions from tsconfig.json</issue_description>Comments on the Issue (you are @copilot in this section)
@jakebailey I'm not sure if the CLI parser supports nulling out flags yet. Seemingly not.
Fixes microsoft/typescript-go#1866
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
@copilot This PR may be too narrowly focused.
nullshould work to unset all of the other options at the CLI too.
The implementation already works for all options, not just customConditions. It uses reflection to iterate through all CompilerOptions fields and checks the raw map for any field set to null. I verified this works with --lib null, --types null, and --outDir null - all correctly override their tsconfig.json values.
@copilot you did not run the formatter as instructed
@copilot you did not run the formatter as instructed
Fixed in commit 81d4e0d. Ran npx hereby format to correct indentation.