Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 10, 2025

  • Add parameter to pass raw command line options through config parsing functions
  • Update mergeCompilerOptions to use raw command line options
  • Update all call sites of ParseJsonSourceFileConfigFilePath
  • Add test for --customConditions null override
  • Run existing tests to ensure no regressions
  • Verify fix works as expected with manual testing
  • Fix nil targetOptions by initializing in parseConfig instead of workaround in 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 null overrides the customConditions and sets it to null

Behavior with tsgo

running tsgo --customConditions null does 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 #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 AI and others added 2 commits October 10, 2025 15:24
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]>
@Copilot Copilot AI changed the title [WIP] Fix handling of --customConditions flag for null value Fix --customConditions null not being respected when overriding tsconfig.json Oct 10, 2025
@Copilot Copilot AI requested a review from jakebailey October 10, 2025 15:37
Copilot finished work on behalf of jakebailey October 10, 2025 15:37
Copy link
Member

@jakebailey jakebailey left a 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.

Comment on lines 543 to 545
if targetOptions == nil {
targetOptions = &core.CompilerOptions{}
}
Copy link
Member

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.

Copy link
Contributor Author

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]>
Copy link
Contributor Author

Copilot AI commented Oct 10, 2025

@copilot This PR may be too narrowly focused. null should 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 Copilot AI requested a review from jakebailey October 10, 2025 16:43
Copilot finished work on behalf of jakebailey October 10, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing --customConditions null it not respected

2 participants