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

(typescript) Template literals no longer work post 11.8.0 #1213

Closed
onionhammer opened this issue Dec 7, 2020 · 8 comments
Closed

(typescript) Template literals no longer work post 11.8.0 #1213

onionhammer opened this issue Dec 7, 2020 · 8 comments

Comments

@onionhammer
Copy link

Example usage

const [ t ]      = useTranslation();

return <>{t`Hello`}</>
 

Worked in react-i18next v 11.7.4, but not 11.8.0, now errors with

No overload matches this call.
  Overload 1 of 2, '(key: never, options?: string | TOptions<StringMap> | undefined): never', gave the following error.
    Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'never'.
  Overload 2 of 2, '(key: never, defaultValue?: string | undefined, options?: string | TOptions<StringMap> | undefined): never', gave the following error.
    Argument of type 'TemplateStringsArray' is not assignable to parameter of type 'never'.  TS2769
@onionhammer onionhammer changed the title Template literals no longer work post 11.8.0 (typescript) Template literals no longer work post 11.8.0 Dec 7, 2020
@tigerabrodi
Copy link
Contributor

Seems to be something that happened after TypeScript PR. Any ideas @pedrodurek ?

@pedrodurek
Copy link
Member

it is the same error #1212

@tigerabrodi
Copy link
Contributor

it is the same error #1212

@pedrodurek I should defo debounce my questions sometimes haha 🤦‍♂️ 😂

@pedrodurek
Copy link
Member

Hey @onionhammer, It should be fixed now. I added the support to template string back, but unfortunately TemplateStringsArray doesn't support generics yet (microsoft/TypeScript#33304), so this PR #1193, which types all keys from t function won't work for you.

@tigerabrodi you were right! This was a different issue indeed, which was returning the same error.

@pedrodurek
Copy link
Member

Hey @onionhammer, can we close this one?

@onionhammer
Copy link
Author

onionhammer commented Dec 9, 2020

@pedrodurek seems like this leads to another breaking change/or perhaps bug; now the result of

t`Something`

is not a string, it's a TFunction, so it cant be passed as a string to props.

@pedrodurek
Copy link
Member

Ohh yeah, it's been handled here: #1217

@onionhammer
Copy link
Author

Closing in favor if #1217

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