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

TypeError: Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes' on PopoverTrigger #5896

Closed
1 of 3 tasks
jonahallibone opened this issue Apr 18, 2022 · 9 comments

Comments

@jonahallibone
Copy link

jonahallibone commented Apr 18, 2022

Description

When I use a PopoverTrigger, I get a TypeError for the children

Link to Reproduction

NA

Steps to reproduce

  1. Create a Popover in a project using TS
  2. Insert a Button in the trigger
  3. See error Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes'.

Screen Shot 2022-04-18 at 6 10 58 PM

Chakra UI Version

1.8.8

Browser

No response

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

No response

@jonahallibone jonahallibone changed the title TypeError: Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes'. on PopoverTrigger TypeError: Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes' on PopoverTrigger Apr 18, 2022
@nftgeek
Copy link

nftgeek commented Apr 19, 2022

Hi @jonahallibone are you using react 18?

@RobinUndersigned
Copy link

Got the same problem with React 18. I guess we need to wait for an Update on this?

@Shing-Ho
Copy link
Contributor

It's because of the types of React 18 issues maybe. Try yarn why @types/React and check if there are two versions for it.

@adrian-amigues
Copy link

Hi, I'm encountering the same issue after upgrading to react 18. I have the latest versions for @types/react (18.0.5) and @types/react-dom (18.0.1).

It seems there was a PR for this (#5845) but it got closed in favor of a broader react-18 related updates (#5856). Maybe the Popover update was forgotten somehow?

It seems the problem comes from the react-18 update in how React.FC is typed, as doesn't include children anymore

@cyberwombat
Copy link

Temp patch:


import {
  PopoverTrigger as OrigPopoverTrigger
} from '@chakra-ui/react'

export const PopoverTrigger: React.FC<{ children: React.ReactNode }> =
  OrigPopoverTrigger

@TylerAPfledderer
Copy link
Collaborator

This was discussed on Discord and determined it was React 18 that was installed and causing the error. This issue should be closed, as reverting to the previous version will solve the problem.

@parth-develops
Copy link

<{ children: React.ReactNode }>

Temp patch:


import {
  PopoverTrigger as OrigPopoverTrigger
} from '@chakra-ui/react'

export const PopoverTrigger: React.FC<{ children: React.ReactNode }> =
  OrigPopoverTrigger

Thanks a lot

@PrashantIndurkar
Copy link

Temp patch:


import {
  PopoverTrigger as OrigPopoverTrigger
} from '@chakra-ui/react'

export const PopoverTrigger: React.FC<{ children: React.ReactNode }> =
  OrigPopoverTrigger

Thanks it works

@ephrinaw
Copy link

Great that is a nice fix.

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