Skip to content

Instantly share code, notes, and snippets.

@brasten
Created October 13, 2021 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brasten/58e273f63982fbd3f1e22d95f662d3c7 to your computer and use it in GitHub Desktop.
Save brasten/58e273f63982fbd3f1e22d95f662d3c7 to your computer and use it in GitHub Desktop.
Destructuring and Typing
class MyClass {
// if destructured renaming wasn't a thing, this is
// what I'd naturally expect. But it's already
// valid JS syntax for renaming, obviously.
constructor({ coreService: CoreService }) {
//...
}
// maybe-ish?
constructor({ coreService as CoreService }) {
//...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment