You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When upgrading to 3.1.3 I get a new error not in 3.0.3:
I see two problems in the type checking of the sample below.
before const lo: number = min!;, the return after null test of either identifier means that both will be non-null.
Even so, I'm asserting non-null and still it thinks it could be null. The subsequent acceptance of lo2 which includes null as an option suggests that it isn't a problem with the T["min"] and number half.
(There is no error without the generic aspect of this sample.)
interfaceRangeSelectorStateBase{min: number|null;max: number|null;}typeRangeSelectorState<T>={[Pinkeyof(T&RangeSelectorStateBase)]: (T&RangeSelectorStateBase)[P];}functionfoo<T>(state : RangeSelectorState<T>){const{ min, max }=state;if(min===null||max===null){return;}constlo: number=min!;// Type 'T["min"] & null' is not assignable to type 'number'.consthi: number=max!;// Type 'T["min"] & null' is not assignable to type 'number'.constlo2: number|null=min;// type-checks fine.consthi2: number|null=max;// type-checks fine.}
Type 'NonNullable<(T & RangeSelectorStateBase)["min"]>' is not assignable to type 'number'.
Type '(T["min"] & null) | (T["min"] & number)' is not assignable to type 'number'.
Type 'T["min"] & null' is not assignable to type 'number'.
Type 'NonNullable<T["min"] & null> | NonNullable<T["min"] & number>' is not assignable to type 'number'.
Type 'NonNullable<T["min"] & null>' is not assignable to type 'number'.
Type 'T["min"] & null' is not assignable to type 'number'.
The text was updated successfully, but these errors were encountered:
When upgrading to 3.1.3 I get a new error not in 3.0.3:
I see two problems in the type checking of the sample below.
const lo: number = min!;
, the return after null test of either identifier means that both will be non-null.T["min"]
andnumber
half.(There is no error without the generic aspect of this sample.)
playground link
Full error text:
The text was updated successfully, but these errors were encountered: