In some circumstances a derived class is not assignable to its base class under --strictFunctionTypes #27047
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Milestone
TypeScript Version: 3.1.0-dev.20180912
Search Terms: class extends assignability strict function types this
Code
Expected behavior:
No errors.
Actual behavior:
The following error is generated on the constant
value
:This only happens when --strictFunctionTypes is enabled.
This shouldn't happen because TS will not let you change a class' type signature in a way that breaks the extends clause -
Derived
is always a superset ofBase
.Playground Link:
http://www.typescriptlang.org/play/#src=class%20Base%20%7B%0D%0A%09private%20foo%20()%3A%20(this%3A%20this)%20%3D%3E%20void%20%7B%0D%0A%09%09return%20(()%20%3D%3E%20%7B%7D).bind(this)%3B%0D%0A%09%7D%0D%0A%7D%0D%0A%0D%0Aclass%20Derived%20extends%20Base%20%7B%0D%0A%09private%20bar%20()%20%7B%7D%0D%0A%7D%0D%0A%0D%0Aconst%20value%3A%20typeof%20Base%20%3D%20Derived%3B
The text was updated successfully, but these errors were encountered: