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

Ambiguous array type: "number | null[]" should be "(number | null)[]" #29

Open
birgersp opened this issue Aug 6, 2024 · 2 comments
Open

Comments

@birgersp
Copy link

birgersp commented Aug 6, 2024

Having some code like this:

const row: { values: (number | null)[] } = { values: [] }

The type is (explicitly) an array of elements where each element is a number or a null,
and not an array of numbers, or a null.

When hovering, the VS Code built-in "type viewer" (whatever it's called) correctly displays the type. But the extension type displays:

number | null[]

... which seems incorrect. The parantheses should be there so the type is unambiguous.

image

@mylesmmurphy
Copy link
Owner

Hey @birgersp!
Thanks for bringing this to my attention. This is definitely being incorrectly displayed in the extension. I've addressed this in #31 and it will be included in the next release v0.1.6, prerelease here if you want to try it out:
https://github.com/mylesmmurphy/prettify-ts/releases/tag/v0.1.6

I will close this out once it's fully tested and released 😄

@mylesmmurphy
Copy link
Owner

Hey @birgersp Just wanted to apologize for the delay, this will get fixed in the next release which I have unfortunately been sitting on, I hope to get it released ASAP 🙏

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