Skip to content

cpvdeveloper/typed-react-intl-keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

typed-react-intl-keys

Edit: there's a much better way to achieve type safety for react-intl keys, just follow the docs!

With react-intl, you can translate messages with the FormattedMessage component or with the formatMessage function. Either way, you have to provide an id for the message, which is ordinarily of type string | number. This means that you can pass any string or any number, even if a message doesn't exist for that ID in your translation files.

But thanks to TypeScript's typeof keyof we can do better...

architecture

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors