-
Notifications
You must be signed in to change notification settings - Fork 392
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
RFC: Default type alias type parameters #61
RFC: Default type alias type parameters #61
Conversation
Interaction with default type arguments and variadic type parameters seems to be missing in this RFC. Are we going to support that, or leave it out? |
It's not left out, it's explicitly prohibited: |
Ah, got it. What's the rationale for leaving it out to start with? Keeping the scope smaller on a as-needed basis? |
The reasoning behind the decision is that while we parse I had this text in an unpublished draft: Default type arguments are allowed for generic type pack parameters: type A<T, U... = ...string> -- ok, variadic type pack
type B<T, U... = (number, number)> -- ok, type pack of two types
type B<T..., U... = T> -- ok
type A<T, U... = string> -- ok, variadic type pack of one type |
Since the only reason is a missing related feature, maybe I should bring default type pack values back and we'll fix that issue during implementation of this RFC (if it's accepted). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see progress on this!
* improved motivation for the feature and noted additional languages with this feature * fixed terminology between 'argument' and 'parameter' * brought back support for default type pack parameter values * removed alternative syntax and described the decision between ':' and '=' in the design section * fixed drawback text and provided an example
@alexmccord I've updated the RFC to include default values for type packs. |
…ues,type annotation syntax doesn't allow that to be stand-alone
-- ambiguity, Type could mean Type<number, string> or Type<A, B>
type Type<A = number, B = string> = { x: number, b: Type? } I don't like the idea that this could ever mean |
No description provided.