Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Point union in typescript is not helpful #69

Closed
dagda1 opened this issue Feb 16, 2020 · 4 comments
Closed

Point union in typescript is not helpful #69

dagda1 opened this issue Feb 16, 2020 · 4 comments

Comments

@dagda1
Copy link
Contributor

dagda1 commented Feb 16, 2020

Hi,

I have just upgraded to the latest version and the type definition for Point has changed to a union which is not helpful.

type Point = { x: number; y: number } | [number, number];

For every union that is created, I have to use type narrowing to determine what it is if the inference cannot work it out.

It was perfect before:

type Point = { x: number; y: number }

I would have a new type for the tuple.

Would you be open to a PR that reverted this?

@chrvadala
Copy link
Owner

Points can be defined as object or array. The previous version didn't cover both cases.

@formatlos
Copy link
Contributor

formatlos commented Mar 28, 2020

I've have already created a PR #67 to tackle this issue a few weeks ago.

@dagda1
Copy link
Contributor Author

dagda1 commented Mar 28, 2020

@formatlos sir, that is the correct answer. Bravo!

@chrvadala
Copy link
Owner

PR 67 has been merged and released with version 2.3.0. I hope that it helps ;)

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

No branches or pull requests

3 participants