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
classA{foo="hi";}classB{}// this is fineconstt: {prototype: {foo: string}}=A;// this complains "types of property 'prototype' are incompatible"constu: {prototype: {foo: string}}=B;
Expected behavior:
Only function properties should exist in prototypes of classes. This reflects the runtime behaviour (all properties are assigned in constructor).
Actual behavior:
Non-function properties appear in the types of classes' prototypes.
The text was updated successfully, but these errors were encountered:
We found that a not-insignificant of people used prototype to create property default values. Since there's not any other way to declare that property and it's a very difficult property to use incorrectly, it was better (and simpler) overall to include instance properties in the prototype.
TypeScript Version: 2.0.0
Code
Expected behavior:
Only function properties should exist in prototypes of classes. This reflects the runtime behaviour (all properties are assigned in constructor).
Actual behavior:
Non-function properties appear in the types of classes' prototypes.
The text was updated successfully, but these errors were encountered: