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

Can't use babel-plugin-react-intl-auto with typescript #196

Open
bin-umar opened this issue Feb 24, 2021 · 2 comments
Open

Can't use babel-plugin-react-intl-auto with typescript #196

bin-umar opened this issue Feb 24, 2021 · 2 comments

Comments

@bin-umar
Copy link

Can you suggest please right types to work with typescript?

 TS2322: Type 'string' is not assignable to type 'Record<string, string> | Record<string, MessageFormatElement[]>'.
@scottdickerson
Copy link

scottdickerson commented May 21, 2021

we're also getting this error

TS2559: Type 'string' has no properties in common with type 'MessageDescriptor'.
    66 | 
    67 | const messages = defineMessages({

Because the react-intl is looking for a Message descriptor type, but we're just passing strings messageKey: 'messageValue'

@waht
Copy link

waht commented Jun 25, 2021

Ran into the same issue. You need to add a reference to the types from this plugin.

Just create a d.ts file (e.g. src/env.d.ts) with the following content:

/// <reference types="babel-plugin-react-intl-auto" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants