Feature Request
Type Expectation
Core types like DeepStrictPick, DeepStrictOmit, DeepStrictMerge, and DeepDateToString lack explicit tests for readonly properties and optional(?:) properties. Since modifier preservation is critical to type safety, explicit tests are needed to prevent regressions.
Example Type
// optional preservation test
type Input = { a?: number; b: string; c?: { d: number } };
type Q1 = DeepStrictPick<Input, "a">;
type A1 = Equal<Q1, { a?: number }>; // verify optional is preserved
// readonly property preservation test
type Input2 = { readonly a: number; b: string };
type Q2 = DeepStrictPick<Input2, "a">;
type A2 = Equal<Q2, { readonly a: number }>; // verify readonly is preserved
// optional + nesting
type Input3 = { a?: { b?: { c: number } } };
type Q3 = DeepStrictPick<Input3, "a.b.c">;
type A3 = Equal<Q3, { a?: { b?: { c: number } } }>;
Proposed Solution
Add edge case tests to existing test files (DeepStrictPick.ts, DeepStrictOmit.ts, DeepStrictMerge.ts, DeepDateToString.ts).
Test Requirements
All changes must include the following tests:
-
Backward Compatibility
- All existing tests must pass
- Add tests to verify that existing type behavior remains unchanged
-
Feature Verification
optional properties are preserved after pick/omit
readonly properties are preserved after pick/omit
- How optional/readonly from both sides are handled during merge
-
Complex Type Stability
{ a?: readonly { b?: number }[] } (optional + readonly + array)
{ readonly a?: { readonly b: Date } } (readonly + optional + Date)
readonly [{ a?: 1 }, { b: 2 }] (readonly tuple + optional)
- Branded type + optional (
{ a?: string & MinLength<1> })
- Union + optional (
{ a?: string | null })
- 3-level nested optional (
{ a?: { b?: { c?: number } } })
How to verify:
npm run build:test && npm run test
npm run prettier
Feature Request
Type Expectation
Core types like
DeepStrictPick,DeepStrictOmit,DeepStrictMerge, andDeepDateToStringlack explicit tests forreadonlyproperties andoptional(?:)properties. Since modifier preservation is critical to type safety, explicit tests are needed to prevent regressions.Example Type
Proposed Solution
Add edge case tests to existing test files (
DeepStrictPick.ts,DeepStrictOmit.ts,DeepStrictMerge.ts,DeepDateToString.ts).Test Requirements
All changes must include the following tests:
Backward Compatibility
Feature Verification
optionalproperties are preserved after pick/omitreadonlyproperties are preserved after pick/omitComplex Type Stability
{ a?: readonly { b?: number }[] }(optional + readonly + array){ readonly a?: { readonly b: Date } }(readonly + optional + Date)readonly [{ a?: 1 }, { b: 2 }](readonly tuple + optional){ a?: string & MinLength<1> }){ a?: string | null }){ a?: { b?: { c?: number } } })How to verify: