-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Intl.DisplayNames missing #41338
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
Comments
Type definitions for drafts are usually not added to the type definitions provided by TypeScript. In the TypeScript-DOM-lib-generator project they list as a requirement for additions:
Neither Firefox nor Safari support this feature. There's no mention of TC39, but it's likely that the same principle applies. You can use declaration merging to make the types available in your code base. |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
The TC39 proposal (https://github.com/tc39/proposal-intl-displaynames) reached stage 4 in September 2020. Fixes microsoft#41338
The TC39 proposal (https://github.com/tc39/proposal-intl-displaynames) reached stage 4 in September 2020. Fixes microsoft#41338
Can we reopen this issue for #44022 ? |
It is now supported in all major browser versions https://caniuse.com/?search=Intl.DisplayNames and is referenced in ECMA402 https://tc39.es/ecma402/#intl-displaynames-objects. I think this might be time to reopen this issue. |
Why this is still causing problems? How to fix it? |
Should be fixed with TypeScript 4.5 according to PR #45647 |
TS playground v5.0.4 still says:
|
@MichalBryxi It works just fine in the Playground when you target an ES version that supports it. |
Ah! So for future travelers: Minimum requirements that seem to work:
|
Search Terms: Intl.DisplayNames, "Property 'DisplayNames' does not exist on type 'typeof Intl'."
Code
Expected behavior: TS knows
DisplayNames
and does appropriate type checking.Actual behavior: TS displays error:
Property 'DisplayNames' does not exist on type 'typeof Intl'.
Playground Link: https://www.typescriptlang.org/play?ts=4.1.0-dev.20201030#code/DYUwLgBMCGB2DmBXa8QDloFsQGcIF4JYQB3CASVjGADoARASxwAcYBPDbHACgG0ByELH4BdADQQA3hDBtmIAFwR+MBMlT8IAXwCUAbgBQECEA
Related Issues: N/A
Respective MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames
Respective TC39: https://tc39.es/proposal-intl-displaynames/
The text was updated successfully, but these errors were encountered: