-
Notifications
You must be signed in to change notification settings - Fork 718
Fix --customConditions null not being respected when overriding tsconfig.json #1868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
When --customConditions null is passed on command line, it should override any value in tsconfig.json. This fix: - Adds a new parameter to pass raw command line options through config parsing - Updates mergeCompilerOptions to handle command line raw options correctly - Adds test to verify customConditions null override behavior Co-authored-by: jakebailey <[email protected]>
- Handle nil OrderedMap in mergeCompilerOptions - Handle nil targetOptions in mergeCompilerOptions - Accept baseline for composite null test (correct behavior) Co-authored-by: jakebailey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot This PR may be too narrowly focused. null
should work to unset all of the other options at the CLI too.
internal/tsoptions/parsinghelpers.go
Outdated
if targetOptions == nil { | ||
targetOptions = &core.CompilerOptions{} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot The target
should never be nil
. It does not make sense to merge into nothing. The caller must be wrong here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 5a52fe3. Instead of checking for nil in mergeCompilerOptions, I now initialize options to an empty struct when a circularity error is detected in parseConfig, ensuring targetOptions is never nil.
Instead of checking for nil in mergeCompilerOptions, properly initialize options to empty struct when circularity error is detected in parseConfig. This ensures targetOptions is never nil when mergeCompilerOptions is called. Co-authored-by: jakebailey <[email protected]>
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. |
Original prompt
Fixes #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.