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
I have a project that enabled allowUnreachableCode option. I wanted to bypass a large condition. So I appended &&false at the end of the condition. But now I can not compile the project due to null check errors.
letanExampleVariable: string|null="Hello World"if(anExampleVariable!=null&&false){letanotherVariable: string=anExampleVariable;// ^^^^^^^^^^^^^^^ Type 'string | null' is not assignable to type 'string'. Type 'null' is not assignable to type 'string'.}
🙁 Actual behavior
Getting Type 'string | null' is not assignable to type 'string'. Type 'null' is not assignable to type 'string'. error.
🙂 Expected behavior
null checks should work as before.
The text was updated successfully, but these errors were encountered:
Bug Report
I have a project that enabled
allowUnreachableCode
option. I wanted to bypass a large condition. So I appended&&false
at the end of the condition. But now I can not compile the project due to null check errors.🔎 Search Terms
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Getting
Type 'string | null' is not assignable to type 'string'. Type 'null' is not assignable to type 'string'.
error.🙂 Expected behavior
null checks should work as before.
The text was updated successfully, but these errors were encountered: