Typing error with React 18
See original GitHub issueDescribe the bug
NextJS build is failing with React 18 and usage of <Trans> component.
Occurs in next-i18next version
11.0.0
Steps to reproduce
info - Loaded env from /.env
Failed to compile.
./src/components/Component.tsx:179:56
Type error: Type '{ freeDays: number; }' is not assignable to type 'ReactNode'.
Object literal may only specify known properties, and 'freeDays' does not exist in type 'ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal'.
177 | <Trans i18nKey="subscribe.freeDays">
178 | You get
> 179 | <span className="family-bold">{{ freeDays }}</span>
| ^
180 | starting today
181 | </Trans>
182 | </p>
info - Checking validity of types .%
Expected behaviour
No typing errors when using variables in Trans component
OS (please complete the following information)
- Device: MBP 2019 16
- Browser: Chrome 100.0.4896.127
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:18 (10 by maintainers)
Top Results From Across the Web
Bug: React 18 types broken since the type release a ... - GitHub
Can we move this issue discussion to the DefinitelyTyped repository? That's where the React typings are maintained, and you'll probably see more ...
Read more >React sur Twitter : "The React 18 TypeScript typings are out ...
The previous typings incorrectly included “children” into props by default even though some components don't accept children or accept a different type.
Read more >React v18 causes error without code changes, JSX no longer ...
It seems to me that with v18 React expects React Nodes everywhere and JSX as such is no longer accepted. These errors disappear...
Read more >Upgrading to React 18 with TypeScript - LogRocket Blog
The upgrade of the React type definitions to support React 18 involved some significant breaking changes that developers should know about.
Read more >React 18 - Property 'children' does not exist fix [2022] - YouTube
If you have recently upgraded to React 18 and tried to follow ... run into the error : Property 'children' does not exist...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pedrodurek Unfortunately, still not working !
It overrides React own definition types, so I’ve got an error like :
I’ve searched and tried to fix this, changing d.ts file :
Declare file into tsconfig.json (both include and typeRoots properties), changing file name but it continues to override base types.
@pedrodurek can you help…? There is probably a bit of confusion.