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

Parse/Generate call signature with keeping argument name #26225

Closed
4 tasks done
whatasoda opened this issue Aug 6, 2018 · 4 comments
Closed
4 tasks done

Parse/Generate call signature with keeping argument name #26225

whatasoda opened this issue Aug 6, 2018 · 4 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@whatasoda
Copy link

I want to do like this.
image

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)
@AlCalzone
Copy link
Contributor

This would be very helpful when combined with #26190 as we could fix the problem that the inferred parameter names are off by one there.

@ahejlsberg
Copy link
Member

Seems to me this can be accomplished using ReturnType<T> (added to lib.d.ts in 3.0) and the Parameters<T> type I suggest here #24897 (comment). The only one thing we don't support is extracting the parameter names, but that doesn't appear to be significant in the example.

@RyanCavanaugh RyanCavanaugh added the Question An issue which isn't directly actionable in code label Aug 6, 2018
@jednano
Copy link
Contributor

jednano commented Mar 13, 2019

@ahejlsberg the Parameters<T> type doesn't preserve the original argument names or TSDoc comments. I think what @whatasoda wants is very similar to the new feature request I just created #30351.

@typescript-bot
Copy link
Collaborator

This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

6 participants