question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `Intl.supportedValuesOf` enumeration to `lib.*.intl.d.ts` as support in Node.js18, and v8, and various browsers exists

See original GitHub issue

lib Update Request

Configuration Check

My compilation target is ES2022 and my lib is "esnext.intl", "es2021.intl", "ESNext","ES2022", "ES2021", "es6".

Missing / Incorrect Definition

The static method Intl.supportedValuesOf is supported by Node.js since v18 release from April. This is missing in the definition of Intl.

Sample Code

Intl.supportedValuesOf("timeZone").forEach(function(timeZone) {
   console.log(timeZone);
});

Documentation Link

Ecmascript - it is listed as a stage3 proposal, but given that it is already implemented in v8 & mentioned in the MDN this seems reasonable.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:14
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
23RoMaxcommented, May 25, 2022

As a temporary solution, I extended the existing type declaration

declare namespace Intl {
  type Key = 'calendar' | 'collation' | 'currency' | 'numberingSystem' | 'timeZone' | 'unit';

  function supportedValuesOf(input: Key): string[];
}
2reactions
karlhorkycommented, Nov 6, 2022

Also available in Node.js LTS (18.18.0):

> Intl.supportedValuesOf('timeZone')
[
  'Africa/Abidjan',
  'Africa/Accra',
  'Africa/Addis_Ababa',
  'Africa/Algiers',
  'Africa/Asmera',
  'Africa/Bamako',
  'Africa/Bangui',
  'Africa/Banjul',
  'Africa/Bissau',
  ... 419 more items
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Intl.supportedValuesOf() - JavaScript - MDN Web Docs
The Intl.supportedValuesOf() static method returns an array containing the supported calendar, collation, currency, numbering systems, ...
Read more >
Intl.supportedValuesOf polyfill for React - Stack Overflow
I was using Intl.supportedValuesOf however, I noticed a fewer list of browsers that support it. I searched on NPM for a Polyfill but...
Read more >
polyfill-intl-enumeration - npm
Simple and clean way to use Intl.supportedValuesOf in Node.js and Browser.; Zero production dependencies; Easy to use and great test ...
Read more >
Mocha - the fun, simple, flexible JavaScript test framework
Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.
Read more >
11 Features in Node.js 18 you need to try - NodeSource
Details of Node.js 18 new features, including fetch API and test runner, along with V8 JavaScript engine 10.1 features, and more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found