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
leta=1;functionfoo(): string|null{returna>10 ? null : "";}exportclassB{test(): void{lett: string|null=foo();if(t!=null){letv: string=t;// ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/string/String'.}}}exportfunctiontest(): void{lett: string|null=foo();if(t!=null){letv: string=t;// ERROR TS2322: Type '~lib/string/String | null' is not assignable to type '~lib/string/String'.}}
The text was updated successfully, but these errors were encountered:
This is expected in 0.19, since != calls an operator overload as a function. Right now the compiler does not attempt to prove what this function does. Using !== fixes the issue for now as it cannot be overloaded. Related to the long standed triple equals discrepancy. Will be tackled by 0.20 by unifying these cases and special-casing comparisons with null.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions!
The text was updated successfully, but these errors were encountered: