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
Search Terms:
property does not exist on type never
Code
classPerson{name: string;constructor(name: string){this.name=name;}}letfoo: Person|null=null;functioninitialize(){foo=newPerson('foo');}initialize();if(foo){console.log(foo.name);// Property 'name' does not exist on type 'never'.}
Expected behavior:
No compile error.
Actual behavior:
Code throws a Property 'name' does not exist on type 'never'.
@jcalz Thanks - Quite a long discussion, good arguments on both sides. I am more in favor of turning the optimistic prediction off (or make it configurable or warning level), but at least we could re-phrase the error message.
TypeScript Version: 3.8.0-dev20200122
Search Terms:
property does not exist on type never
Code
Expected behavior:
No compile error.
Actual behavior:
Code throws a
Property 'name' does not exist on type 'never'.
Playground Link:
playground example
Related Issues:
#35644
Labelled as fix available for 3.8.1, but does not work for 3.8.0-dev20200122
The text was updated successfully, but these errors were encountered: