-
Notifications
You must be signed in to change notification settings - Fork 124
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
Better Object.entries #167
Conversation
Todo: update readme |
Please read the section in the readme that describes why we won't make this change. |
Alright, didn't see it in the GitHub Readme. Makes sense though |
@mattpocock This seems to be gone from the README. Could you add the note here? |
Found it: Rules we won't add
|
Bruh this issue was closed 3 months ago how'd you even find it |
Intro
This type changes the behaviour of
Object.entries
to return more specific types:Caveats
const
keyword for more specific results. Therefore, the difference between the results ofObject.entries
in TypeScript 5 would be even bigger, since theas const
part would be omitted.In earlier versions, for specific results, the
as const
assertion needs to be added to inputs.Object.entries
cannot be relied on, therefore a union of tuples is returned instead of a deterministic tuple (i.e.(["a", 1"] | ["b", 2])[]
and not[["a", 1], ["b", 2]]
)