Skip to content
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

Named type argument #5053

Closed
tinganho opened this issue Oct 1, 2015 · 5 comments
Closed

Named type argument #5053

tinganho opened this issue Oct 1, 2015 · 5 comments
Labels
Duplicate An existing issue was already created

Comments

@tinganho
Copy link
Contributor

tinganho commented Oct 1, 2015

A spin-off idea from #2175. If a class has many type parameters and let say that default type parameter gets landed. And If I have a class with three type parameters like below:

class CustomComponent<P, S, E> extends React.Component<P = {}, S = {}, E = {}> {
}

Now, I just want to assign a type to one of the type parameter S:

 new CustomComponent<{}, { a: string }, {}>;

The above solution is quite redundant since you need to assign a type to the type parameters P and E too. When in fact, you just want to assign a type to the type parameter S.

I suggest named type argument to solve this problem:

 new CustomComponent<S = { a: string }>;

In the above solution, I don't need to assign any type to the type parameters P and E.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 1, 2015

this looks like a syntax proposal for the implementation of #2175. if you agree, i would keep it in #2175, instead of a separate issue.

@tinganho
Copy link
Contributor Author

tinganho commented Oct 2, 2015

OK I its fine.

On Fri, Oct 2, 2015, 02:10 Mohamed Hegazy notifications@github.com wrote:

this looks like a syntax proposal for the implementation of #2175
#2175. if you agree, i
would keep it in #2175
#2175, instead of a
separate issue.


Reply to this email directly or view it on GitHub
#5053 (comment)
.

@mhegazy mhegazy added the Duplicate An existing issue was already created label Oct 2, 2015
@mhegazy mhegazy closed this as completed Oct 2, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Oct 2, 2015

thanks!

@tinganho
Copy link
Contributor Author

@mhegazy shouldn't this issue be reopnened, since the PR #13487 is mentioning that it fixes #2175, but does not include named type argument?

@tinganho tinganho changed the title Named type parameter Named type argument Jan 29, 2017
@tinganho
Copy link
Contributor Author

@mhegazy can you revisit this? I think you miss a lot if you just have #2175 and not this one.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants