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
typeA={name: string}typeB={name: stringid: number}typeC=A|Bconsta: C={name: '1',id: undefined,// expect an error}constb: C={name: '1',id: undefined,// an ts2322 errorvalue: 2,}
π Actual behavior
The var a does not report any error, but the var b report error "Type 'undefined' is not assignable to type 'number'(2322)".
Before v3.7.5, it will report error "Type '{ name: string; id: undefined; value: number; }' is not assignable to type 'C'.
Object literal may only specify known properties, and 'value' does not exist in type 'C'.(2322)" on b.
But I think the error should occur on var a too.
π Expected behavior
The error reported on b should also be reported on var a.
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
type or, adding undefined, TS2322
π Version & Regression Information
Maybe it is from the beginning
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
The var a does not report any error, but the var b report error "Type 'undefined' is not assignable to type 'number'(2322)".
Before v3.7.5, it will report error "Type '{ name: string; id: undefined; value: number; }' is not assignable to type 'C'.
Object literal may only specify known properties, and 'value' does not exist in type 'C'.(2322)" on b.
But I think the error should occur on var a too.
π Expected behavior
The error reported on b should also be reported on var a.
The text was updated successfully, but these errors were encountered: