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

[Feature request] allow set type when use let { a } = argv #31049

Closed
2 of 5 tasks
bluelovers opened this issue Apr 20, 2019 · 3 comments
Closed
2 of 5 tasks

[Feature request] allow set type when use let { a } = argv #31049

bluelovers opened this issue Apr 20, 2019 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@bluelovers
Copy link
Contributor

Search Terms

Suggestion

allow set type when use

  • let { a } = argv => let { a as string } = argv
  • ({ a } = argv); => ({ a as string } = argv);

Use Cases

Examples

Checklist

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. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@Mcfloy
Copy link

Mcfloy commented Apr 21, 2019

You can already do this with let { a } = argv as { a: string }

@bluelovers
Copy link
Contributor Author

bluelovers commented Apr 22, 2019

@Mcfloy i don't wanna do that way when i use let { a, b, c } = argv and only a type is incorrect

@DanielRosenwasser
Copy link
Member

Duplicate of #7576.
Duplicate of #29526.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants