Add testcases for Partial<T> rest spreading with keyof T #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds comprehensive test coverage for the prior commit that changed rest spreading behavior to use
Partial<T>
instead ofOmit<T, keyof T>
when the omit key containskeyof T
.Background
The previous commit implemented a suggestion from microsoft#62572 to improve the type inference for rest spreading when using
keyof T
as the omitted key. Previously, the type system would produceOmit<T, keyof T>
, but the more accurate type isPartial<T>
since any property could potentially be omitted.Test Coverage Added
This PR adds two complementary test files:
restSpreadingWithKeyofT.ts
- Testing Partial behaviorValidates that
Partial<T>
is correctly used in 8 scenarios:restSpreadingWithOmit.ts
- Contrast casesShows when
Omit<T, K>
is still correctly used (6 test cases):Validation
These tests ensure the feature works correctly and provide clear documentation of the behavior for future maintainers.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.