-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EventedConstructor incorrectly typed #113
Comments
@mmckenziedev have you run into an issue with this yet? |
@dylans I haven't had problems using Declare to mix this in to other classes. I agree that technically this class is an ES5 class and shouldn't use DeclareConstructor. However, in practice, if you're using Declare to create a new class and you try to mix this in, if it is not a DeclareConstructor then it won't work properly due to the way Declare is defined. If it's not breaking anything I would prefer to leave this as it is for now. When Typescript 2.2 comes out, and we can finally have a better expression syntax for mixins, then we could refactor the way Declare works. https://github.com/Microsoft/TypeScript/wiki/Roadmap#22-february-2017 |
Yeah, the pattern used with DeclareConstructor makes this a sticky issue to resolve. It's usage should be OK with
Which results in the error
The error may be due to Evented having two different constructors:
I was able to resolve by "fixing" the typings
I haven't had a chance to play with TypeScript 2.2. Hopefully we'll be able to define mixin classes as purely ambient declarations that return functional constructors. If we have to apply it as a pattern in code and actually have to return a class that extends from a declare statement, I would be concerned about losing the metadata added by declare to allow for functional chaining via Anyway, all of this created a rabbit hole I knew I didn't want to go down on my own. |
This issue bit me as well. Is #113 (comment) the prescribed way around it for now? |
Evented
isn't created withdeclare
. It's a traditional es5 class function.This needs fixing:
The text was updated successfully, but these errors were encountered: