Closed
Description
Bug Report
Based on the MDN documentation resolvedOptions of DisplayNames (and all other intl apis) should contain a locale
property
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions
🔎 Search Terms
Intl.DisplayNamesOptions
resolvedOptions
locale
🕗 Version & Regression Information
4.5.2
- I was unable to test this on prior versions because these types only became available in 4.5.2
⏯ Playground Link
Playground link with relevant code
💻 Code
// Copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions
const displayNames = new Intl.DisplayNames(['de-DE'], {type: 'region'});
const usedOptions = displayNames.resolvedOptions();
console.log(usedOptions.locale); // "de-DE"
console.log(usedOptions.style); // "long"
console.log(usedOptions.type); // "region"
console.log(usedOptions.fallback); // "code"
🙁 Actual behavior
console.log(usedOptions.locale);
has a typing error
Property 'locale' does not exist on type 'DisplayNamesOptions'.(2339)
🙂 Expected behavior
No type error because MDN's documentation seems to be correct across all browsers which support Intl.