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

Handle spread of non-object #1

Closed
AlbertLucianto opened this issue Dec 1, 2019 · 1 comment
Closed

Handle spread of non-object #1

AlbertLucianto opened this issue Dec 1, 2019 · 1 comment

Comments

@AlbertLucianto
Copy link

In proposal-object-rest-spread, it is stated that:

  1. If source is undefined or null, let keys be a new empty List.

Practically, you can try on Chrome console to see the output of non-object spread. As an example:

Screenshot 2019-12-01 at 12 27 36 PM

Currently, if you do this (spreading non object), typescript will raise

Spread types may only be created from object types.ts(2698)

But actually it's allowed and here's an issue related to this.

@felixputera
Copy link
Owner

If I'm understanding correctly, you're expecting this transform to allow spreading non-object as per the ES proposal.

I'd say that this is not the objective of this transform (and sorry for choosing a ambiguous name), which is to re-write spreaded objects as property assignments. I had updated the README (https://github.com/felixputera/ts-transform-object-spread#motivation) with more details so I hope that it clarifies my intention!

Thanks for opening an issue anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants