Skip to content
Myr

fix(ts): Immutable<T> / read-only arrays in TS 3.4+

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alec Larson · committed by Alec Larson · parent a5ce2ae · Browse files · 1 file+5 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−1 removed

  • other:+5 added−1 removed

1 file+5 added−1 removed

modified:src/immer.d.ts+5 added-1 removed
51 unmodified lines
52 : Return extends Promise<infer Result>53 ? Promise<Result extends void ? Base : FromNothing<Result>>54 : FromNothing<Return>5556type ImmutableArray<T extends ReadonlyArray<any>> = {57 [P in Extract<keyof T, number>]: ReadonlyArray<Immutable<T[number]>>58}[Extract<keyof T, number>]5960type ImmutableTuple<T extends ReadonlyArray<any>> = {61 readonly [P in keyof T]: Immutable<T[P]>62}63
2 unmodified lines
66 ? T extends AtomicObject67 ? T68 : T extends ReadonlyArray<any>69 ? Array<T[number]> extends T66 ? {[P in keyof T]: ReadonlyArray<Immutable<T[number]>>}[keyof T]70 ? ImmutableArray<T>71 : ImmutableTuple<T>72 : {readonly [P in keyof T]: Immutable<T[P]>}73 : T74
178 unmodified lines