-
Notifications
You must be signed in to change notification settings - Fork 12.8k
feat(46907): Add Intl.ListFormat
type declarations
#47254
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
Conversation
ListFormat
type declarationsIntl.ListFormat
type declarations
…n, link to Array MDN page
V8 has supported `Intl.ListFormat` since version 7.2, but TypeScript doesn't have typings for it yet. This PR manually adds those typings, copying them from microsoft/TypeScript#47254. Fixes denoland#13199.
V8 has supported `Intl.ListFormat` since version 7.2, but TypeScript doesn't have typings for it yet. This PR manually adds those typings, copying them from microsoft/TypeScript#47254.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems correct, though you probably need the aforementioned | undefined
.
* | ||
* [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters). | ||
*/ | ||
type ListFormatLocaleMatcher = "lookup" | "best fit"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final comment: I'm noticing that none of the options above have defined types (or make use of the new ones); is that intentional? Is it more "correct" to not have defined types for any of them? Or do they need to be fixed to have defined types too?
(I'm also noticing that there are some silly things above like "best fit" | "best fit"
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not touch it in this PR, but create a follow-up PR in the next days instead.
- Create named types for the options above, remove duplicate
"best fit"
- Investigate if
ResolvedDateTimeFormatOptions
is even correct (at a first glance, it seems wrong, but might be to match some unique browser behavior?)
Feel free to disagree, I can also tackle them here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure a second PR is fine, I just wasn't sure (I have no major knowledge of these types) whether or not it's normal to have top level declared type names or not.
Fixes #46907