-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Unable to specify return type of class extends T implements IFooable #15001
Comments
Duplicate of #14075, #14597
This makes mixins much more cumbersome to use.
|
I wonder if this would be resolvable with #6606 |
class expressions are not allowed in type positions. the fix would be to allow it, and then emit it in the declaration emitter. |
A partial workaround is to declare the return type using types pre-defined outside of the function, but non-class types can not have |
Nice! Looks like a recent release (3.6.4?) has fixes that allow my lib to specify This allows me to set It does mean that I need to ship the source TS files instead of just declaration files. |
I too have problems with declarations and mixins. Shipping the source is an option but I would prefer otherwise. Any idea on how to do that? |
TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)
Code
If I turn on "declaration: true" in tsconfig.json this constuct breaks since the Anonymous class counts as private and not exported type (error TS4060) which is kind of natural since it is Anonymous.
What we need is a way to describe Classes as return types.
Expected behavior:
A d.ts file with a type declaration for the Mixin function Fooable that defines a Anonymous Class return type in the style of:
Actual behavior:
TS4060 error when compiling with the "declaration" flag.
If casting the Anonymous Class return value to or T, the interface is lost.
The text was updated successfully, but these errors were encountered: