Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use typesVersions to check existence of Intl.LocalesArgument type
- Loading branch information
1 parent
6e689dc
commit c6554c5
Showing
4 changed files
with
47 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export * from './index'; | ||
|
||
declare global { | ||
// `Intl.LocalesArgument` type was recently added to TS — polyfilled here via `typesVersions` in `package.json` for | ||
// compatibility with TS versions older than v4.7.4. | ||
// TODO: Revisit/remove once TS >= v4.7.4 is widespread enough. | ||
namespace Intl { | ||
/** | ||
* The locale or locales to use | ||
* | ||
* See [MDN - Intl - locales | ||
* argument](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument) | ||
*/ | ||
type LocalesArgument = | ||
| UnicodeBCP47LocaleIdentifier | ||
| globalThis.Intl.Locale | ||
| readonly (UnicodeBCP47LocaleIdentifier | globalThis.Intl.Locale)[] | ||
| undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters