Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intl.DisplayNamesOptions missing property locale #46845

Closed
k2snowman69 opened this issue Nov 18, 2021 · 1 comment · Fixed by #46849
Closed

Intl.DisplayNamesOptions missing property locale #46845

k2snowman69 opened this issue Nov 18, 2021 · 1 comment · Fixed by #46849
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript
Milestone

Comments

@k2snowman69
Copy link

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.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Nov 18, 2021
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Nov 18, 2021
@gfyoung
Copy link
Contributor

gfyoung commented Dec 18, 2021

@RyanCavanaugh @orta:

This issue is related to #45647 as well.

I saw you guys closed #47143 a few days ago and added it to the next release.

Could this issue (and PR) also be reviewed and included as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants