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
Is your feature request related to a problem? Please describe.
Global formats are awesome. It's great to help achieve consistency in my application. However, if I create these global settings for the formatter, they won't be typesafe
format.dateTime(new Date('2020-11-20T10:36:01.516Z'), 'short'); // => the second parameter requested is always of type 'string'.
Describe the solution you'd like
I'd like for the formatter to be of a narrower type, based on the template literal values of what I added in my config
As you can see, this ALMOST works. I am extending/rewriting the return type of createFormatter from use-intl. In my code, now the dateFormat function is typesafe.
However, there is a big problem: since I completely redeclared the return type of createFormatter, now I all of the typesafety for all other methods are gone, and only this function is declared inside it 😛
The text was updated successfully, but these errors were encountered:
I absolutely agree, would love to have this but haven't found the time yet to look into this. There's already an issue open at #1112, I'll close this in favor of the former one.
Let me know in case you'd be interested in helping out with this!
Is your feature request related to a problem? Please describe.
Global formats are awesome. It's great to help achieve consistency in my application. However, if I create these global settings for the formatter, they won't be typesafe
format.dateTime(new Date('2020-11-20T10:36:01.516Z'), 'short'); // => the second parameter requested is always of type 'string'.
Describe the solution you'd like
I'd like for the formatter to be of a narrower type, based on the template literal values of what I added in my config
Describe alternatives you've considered
In my global.d.ts file:
my
@kdx/locales
file:As you can see, this ALMOST works. I am extending/rewriting the return type of

createFormatter
from use-intl. In my code, now the dateFormat function is typesafe.However, there is a big problem: since I completely redeclared the return type of
createFormatter
, now I all of the typesafety for all other methods are gone, and only this function is declared inside it 😛The text was updated successfully, but these errors were encountered: