segmentio / evergreen

🌲 Evergreen React UI Framework by Segment

Home Page:https://evergreen.segment.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

xohnny1337 opened this issue · comments

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)

@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)

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

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