-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Better error messages for mixins #17504
Comments
@andy-ms thank you! I didn't realize the signature had to be exactly |
@DanielRosenwasser recommendations? |
Related span:
|
Correction: We actually actually need: function g<T extends new(...args: any[]) => {}>(C: T) {
return class extends C {}
} Returning |
People have been getting this wrong for over a year. Maybe TypeScript should add a |
TypeScript Version: nightly (2.5.0-dev.20170727)
Issue #4890, "Allow class to extend from a generic type parameter", is marked solved. So let's try it out:
Huh? We get
src/a.ts(2,23): error TS2507: Type 'T' is not a constructor function type.
.That's not too intuitive since it worked fine with
C: new() => any
.We actually need:
Maybe the error message should mention something about needing
...args: any[]
?The text was updated successfully, but these errors were encountered: