-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Type aliases within classes #2642
Comments
Quite useful, specifically for the use case of a type depending the type from polymorphic classes. |
It could also be helpfull in terms of this issue: #235. For example, now, as a workaround, it is suggested ( (in #307 by @jeffmo) to do something like that: type funcArg = {a: string, b: string};
var myfunction = ({a, b}:funcArg) => { ... } But currently it is not applicable to class methods because we can not define type aliases inside class definitions. |
Agreed with @sebnow, this would be helpful to simplify type annotations inside polymorphic classes. |
Agreed, this feature is very useful for generate type just like @dchambers mention. Currently, I use a workaround like following. But it look is so ugly, and it may cause other compile error if there has more complex types. class C<
T,
Ts: Array<T> = Array<T>
> { } |
Flow could really do with a way to define type aliases within a class, for example;
I've put a lot of effort into avoiding the need for this feature, but it's been really hard to avoid:
Nobody else has yet requested this feature yet, so maybe I'm just doing things wrong?
The text was updated successfully, but these errors were encountered: