use-pusher
use-pusher copied to clipboard
React 18: Property 'children' does not exist on type 'IntrinsicAttributes & PusherProviderProps'.
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.
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>
>