proposal-await.ops icon indicating copy to clipboard operation
proposal-await.ops copied to clipboard

Implementation in TypeScript

Open Jack-Works opened this issue 5 years ago • 1 comments

I did an implementation for this proposal just for fun. https://github.com/Jack-Works/TypeScript/tree/await.ops

  • [x] Syntax: Basic support
  • [x] Type: Basic support
  • [x] Transpile: Downlevel to ES2020
  • [x] Type: Support concrete tuple type
  • [x] Type: Check if Promise.{*} exists
  • [x] ~~Syntax: Require a space after the operator? (Current impl await.all[array] is valid)~~
  • [ ] Service: Auto complete after await.
  • [ ] Service: Syntax highlight
  • [ ] Service: Refactor suggestion
  • [ ] Service: Hover quickinfo?
  • [x] Type: Unique type error message

Screenshots:

image

In TypeScript, Promise.all has 10 generic signatures. If the array has more than 10 items in it, it will fail. The new syntax does not have this limitation.

image

Downgraded to ES2020, they are the same.

image

Support iterables

Jack-Works avatar Jun 21 '20 06:06 Jack-Works

Playground v2: https://www.typescriptlang.org/play/index.html?ts=4.0.0-pr-39224-4&ssl=1&ssc=1&pln=5&pc=2#code/IYZwngdgxgBAZgV2gFwJYHsIwLbFRACgEoYBvAKBipmAHc9kA6YAGxZgAZLqpMRkYAbQAeAXRgBeGvVRNWLQQAUATumyoQAU0bLNIdCwBumggCYAzOaKjuVYY2ToAosIAOmTRDSti5AL5AA

Playground v3: Playground Link

Jack-Works avatar Jun 24 '20 15:06 Jack-Works