Skip to content

Intl.DisplayNamesOptions missing property locale #46845

Closed
@k2snowman69

Description

@k2snowman69

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions