GeezerVison is showing github.com — fix: add `Intl.getCanonicalLocales` type definition by kazupon · Pull Request #56079 · microsoft/TypeScript
Conversation
Fixes #29129
The issue to resolve this PR is not Backlog milestone.
Intl.getCanonicalLocales type definition should be included in #45647, but unfortunately it could not do.
Even now, the Intl.getCanonicalLocales type is not resolved.
We can check it in the playground.
https://www.typescriptlang.org/play?ssl=1&ssc=6&pln=1&pc=25#code/JIOwLgNgdA5gpmAwgQxAexASwMbIgGTVwjgGcg
about Intl.getCanonicalLocales
why do i add as es2016.intl
Intl.getCanonicalLocales is supported since 2016, so some proejcts using typescript might still use es2016.
I've added es2016.intl.d.ts for compatibility and defined in it.
Parameters and return types of Intl.getCanonicalLocales
UnicodeBCP47LocaleIdentifier is not defined at es2020.intl.d.ts. In the past, A comment of #39662 has tried to support UnicodeBCP47LocaleIdentifier by defining it in es2016.
However, if we do that, it will result in a destructive change for some users, as this comment states.
UnicodeBCP47LocaleIdentifier is currently an alias for string. So, as a compromise, the parameters and return value of Intl.getCanonicalLocales are defined as string. by that way, we can keep compatibility.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The TypeScript team hasn't accepted the linked issue #29129. If you can get it accepted, this PR will have a better chance of being reviewed.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@microsoft-github-policy-service agree
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
kazupon reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|