You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drafts are not included into libs. You can declare a d.ts file with the definitions:
declarenamespaceIntl{functiongetCanonicalLocales(locales: string|string[]): string[];classRelativeTimeFormat{constructor(locale: string);// TODO Add other properties/methods}// const RelativeTimeFormat: any; // Use this instead of the class if you don't want to declare all properties/methodsclassListFormat{constructor(locale: string);// TODO Add other properties/methods}// const ListFormat: any; // Use this instead of the class if you don't want to declare all properties/methods}
Everything appears to be updated and available in one of the compiler lib.d.ts versions such as ES2020.Intl... except for getCanonicalLocales. That seems strange to me.
Reacted by Peter Wong, Helena Steck, Linus, Jayden Seric, leroy li, Andrew Borstein, AkaraChen, Julien Martins Da Costa, luki333, Vitalii Hopaniuk and 4 more
Activity
dtruffaut commentedon Dec 23, 2018
Same thing with
Code
Expected behavior:
Code works
https://developers.google.com/web/updates/2018/10/intl-relativetimeformat
Actual behavior:
TS Error 2339, the property RelativeTimeFormat does not exists on Intl
dtruffaut commentedon Dec 23, 2018
Same thing with
Code
Expected behavior:
Code works
https://developers.google.com/web/updates/2018/12/intl-listformat
Actual behavior:
TS Error 2339, the property ListFormat does not exists on Intl
[-][i18n] Intl.getCanonicalLocales > 2339 error[/-][+][i18n] Intl getCanonicalLocales / RelativeTimeFormat / ListFormat > 2339 error[/+]dtruffaut commentedon Dec 23, 2018
How can I extend the Intl object in a types.d.ts file ?
j-oliveras commentedon Dec 23, 2018
Drafts are not included into libs. You can declare a
d.tsfile with the definitions:dtruffaut commentedon Dec 23, 2018
Thank you !
Administrators will close this issue when the features are definitively implemented.
For now, the workaround works like a charm.
Dassderdie commentedon Oct 25, 2019
Is there any update on this? RelativeDateTime should is now more than a draft: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RelativeTimeFormat
longlho commentedon Oct 25, 2019
feat(lib/es2020.intl): Add `Intl.RelativeTimeFormat` (part of microso…
fix(lib/es2020.intl): fix for tests and linters `Intl.RelativeTimeFor…
Add d.ts for Intl.RelativeTimeFormat (#36084)
jessamp commentedon Aug 13, 2020
Has Intl.ListFormat been added for support?
alex-kinokon commentedon Sep 17, 2020
It is now stage 4.
noinkling commentedon Nov 17, 2020
One of the polyfills for
Intl.ListFormathas its own declaration file that you can use in the meantime.RelativeTimeFormathas already been added.#39662 is pending for
getCanonicalLocalesblessanm86 commentedon Aug 20, 2022
I tried adding the target as
ES2021mentioned in the linked issue but still get an error forListFormat.I am using typescript version v4.6.2
longlho commentedon Aug 20, 2022
Try adding esnext & upgrade to 4.7
wycats commentedon Jan 30, 2023
What's the deal with this?
cvkline commentedon Feb 2, 2023
Everything appears to be updated and available in one of the compiler lib.d.ts versions such as ES2020.Intl... except for
getCanonicalLocales. That seems strange to me.AkaraChen commentedon Apr 26, 2023
Any update on it?
pindatm commentedon Nov 23, 2023
I see this is merged, what version can we expect this in? It doesn't seem to be in 5.3.2 using this config
sandersn commentedon Nov 27, 2023
Must have been after the 5.3 cutoff, because it's only in
mainbranch, notrelease-5.3.That means it'll be available in 5.4.