Polymer / polymer-decorators

TypeScript decorators for Polymer.
Other
93 stars 23 forks source link

Using mixinBehaviors with @customElement requires type assertion #81

Closed opus1269 closed 5 years ago

opus1269 commented 5 years ago

In order to extend from mixinBehaviors, it is necessary to define the class as such:

@customElement('slide-animatable') export default class SlideAnimatable extends (mixinBehaviors([NeonAnimatableBehavior], PolymerElement) as new () => PolymerElement) {}

Without the type assertion, TypeScript gives the following error:

C:\Users\mike\Documents\GitHub\screensaver\app\elements\slide-animatable\slide-animatable.ts(17,1): error TS2345 Argument of type 'typeof SlideAnimatable' is not assignable to parameter of type '(new () => PolymerElement) & ElementConstructor'.