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
Where NowElements.BaseView is an abstract class that extends Polymer.Element.
Expected Results
Successful compilation and execution.
Actual Results
TypeScript compilation error:
Error:(8, 84) TS2345: Argument of type 'typeof BaseView' is not assignable to parameter of type 'new () => BaseView'.
Cannot assign an abstract constructor type to a non-abstract constructor type.
Browsers Affected
All
Versions
master
What's a little frustrating about this is that the everything works fine if you change the type declaration to the following:
Clearly this is a pretty unsafe type declaration, but since the code runs, it's clear that JavaScript has no problem using an abstract class; it's a TypeScript issue.
I'm not sure there's a good solution for this, given there is a TypeScript limitation: microsoft/TypeScript#5843, but I think it's worth discussion so we can at the very least say something in the docs.
The text was updated successfully, but these errors were encountered:
It appears that the upstream TypeScript issue has been closed as [working as intended]: microsoft/TypeScript#5843 (comment) Not sure how we can resolve this issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!
Description
The typings for
Polymer.mixinBehavior()
do not allow use of abstract classes.Steps to Reproduce
Example:
Where
NowElements.BaseView
is an abstract class that extendsPolymer.Element
.Expected Results
Successful compilation and execution.
Actual Results
TypeScript compilation error:
Browsers Affected
All
Versions
master
What's a little frustrating about this is that the everything works fine if you change the type declaration to the following:
Clearly this is a pretty unsafe type declaration, but since the code runs, it's clear that JavaScript has no problem using an abstract class; it's a TypeScript issue.
I'm not sure there's a good solution for this, given there is a TypeScript limitation: microsoft/TypeScript#5843, but I think it's worth discussion so we can at the very least say something in the docs.
The text was updated successfully, but these errors were encountered: