segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.38k stars 830 forks source link

Property 'children' does not exist on type 'IntrinsicAttributes & TooltipProps'. #1617

Closed xohnny1337 closed 1 year ago

xohnny1337 commented 1 year ago

I'm unable to build my app because of a typescript error caused by the Tooltip component in version 7.1.3

Type '{ children: Element; content: string | undefined; }' is not assignable to type 'IntrinsicAttributes & TooltipProps'. Property 'children' does not exist on type 'IntrinsicAttributes & TooltipProps'.ts(2322)

brandongregoryscott commented 1 year ago

@xohnny1337 Can you provide a CodeSandbox to reproduce this? The Tooltip didn't change in the most recent release, but we did remove the bundled @types/react dependency in https://github.com/segmentio/evergreen/releases/tag/v7.1.0 (more specifically in #1590)

xohnny1337 commented 1 year ago

https://codesandbox.io/s/distracted-dubinsky-wd2qkc?file=/src/App.tsx

xohnny1337 commented 1 year ago

I believe it's a React 18 thing: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html - Updates to TypeScript definitions.

The most notable change is that the children prop now needs to be listed explicitly when defining props...

Looking at the TooltipProps in the version 7.1.3 it seems the children prop is not defined. I guess a fix would be to update the exported TooltipProps interface with children: React.ReactNode @brandongregoryscott

brandongregoryscott commented 1 year ago

Ah, yeah, there's probably a lot of components that will need to have children explicitly defined then.