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
declare global {classA{publicf(): void;}classBAextendsA{publicf(): void;}classCAextendsA{publicf(): void;}classDextendsCA{publicf: BA['f'];// errors with 3.7}}exportdefaultundefined;
Expected behavior: use declarations without error
Actual behavior: errors with Class 'CA' defines instance member function 'f', but extended class 'D' defines it as instance member property.
I'm getting the same issue, namely when using react lifecycle methods that have an arrow function.
componentWillMount = () => {...}
/*Throws 'Class component'' Props<State, any> defines instance member function componentDidMount, but extended class 'X ' defines it as an instance member property
*/
Error is fixed with:
componentWillMount() {....}
The problem with the workaround, is that to my knowledge it will change what is bound to context of 'this' under certain scenarios. Could someone please clarify on this?
Confirmed. The issue is solved for me as well since 3.7.0-dev.20191016.
bre1470
changed the title
3.7: instance member function becomes instance member property in type references
3.7: instance member function becomes instance member property in type references [outcome: fixed since 3.7.0-dev.20191016]
Oct 17, 2019
TypeScript Version: 3.7.0-dev.20191002
Search Terms: instance member property
Code
Expected behavior: use declarations without error
Actual behavior: errors with
Class 'CA' defines instance member function 'f', but extended class 'D' defines it as instance member property.
Playground Link: https://www.typescriptlang.org/play/?ts=Nightly#code/CYUwxgNghgTiAEBzCB7ARlC8DeAoeB8kUAzifAII76G0AOArmhAJZjwBmAFAJQBc8AG4oWwANw0CAX0lFoZeACEqIAB4AXEADtg5Knlr0mrdt35CR42TNrEFAYRUbtuytUOFGzNp14DhohK0NoR25AAi8GqaOuSO7h7wXiacAsoA2gDkHJkAumLwAPSFUTAwKDDkAO4s6gAW8ADMAHQA7Na4MrhgKFokKBAgzaiIXJkAEiAQqAA08FUVEMAAhJk8ErhqdBXq8KAcUAwQuww6IBwsWiBWQA (compiles there without error)
Related Issues: -
The text was updated successfully, but these errors were encountered: