use-pusher icon indicating copy to clipboard operation
use-pusher copied to clipboard

React 18: Property 'children' does not exist on type 'IntrinsicAttributes & PusherProviderProps'.

Open francisashley opened this issue 2 years ago • 1 comments

Describe the bug

Using usePusher in a React 18 TypeScript project throws the error:

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

This is because React 18 Requires children?: React.ReactNode to be defined in the component props which is missing here.

francisashley avatar Jan 11 '23 17:01 francisashley

Try this

import type { FC, PropsWithChildren } from 'react'
import {
  PusherProvider as $PusherProvider,
  type PusherProviderProps,
} from '@harelpls/use-pusher'

const PusherProvider = $PusherProvider as FC<
  PropsWithChildren<PusherProviderProps>
>

KBeDevel avatar Jan 26 '23 19:01 KBeDevel