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
classC{privatep: string;}varstrOrC: string|C;varc: C;// A type guard of the form typeof x === s,// where s is a string literal with any value but 'string', 'number' or 'boolean',// - when true, removes the primitive types string, number, and boolean from the type of x, or// - when false, has no effect on the type of x.if(typeofstrOrC==="Object"){c=strOrC;// C}else{varr2: string=strOrC;// string | C, 2322 ERROR}
If strictNullCheck is false
classC{privatep: string;}varstrOrC: string|C;varc: C;// A type guard of the form typeof x === s,// where s is a string literal with any value but 'string', 'number' or 'boolean',// - when true, removes the primitive types string, number, and boolean from the type of x, or// - when false, has no effect on the type of x.if(typeofstrOrC==="Object"){c=strOrC;// C}else{varr2: string=strOrC;// string}
The text was updated successfully, but these errors were encountered:
sunrabbit123
changed the title
Type guard of form type of other should be filter string | number | boolean
[extra error] Type guard of form type of other should be filter string | number | boolean
Aug 8, 2023
If strictNullCheck is true
If strictNullCheck is false
releated issue
#1005 - #1005 (comment)
test case url
https://github.com/dudykr/stc/blob/main/crates/stc_ts_type_checker/tests/conformance/expressions/typeGuards/typeGuardOfFormTypeOfOther.ts
The text was updated successfully, but these errors were encountered: