React forwardRef Type '{ ref: MutableRefObject; }' is not assignable to type 'IntrinsicAttributes & Props & { children?: ReactNode; }'.
TypeScript error in C:/dev/mx4d-ui/src/js/component/login/login-card.tsx(96,22):
Type '{ ref: MutableRefObject<BannerRef>; }' is not assignable to type 'IntrinsicAttributes & Props & { children?: ReactNode; }'.
Property 'ref' does not exist on type 'IntrinsicAttributes & Props & { children?: ReactNode; }'. TS2322
94 | return (
95 | <>
> 96 | <BannerIfANy ref={bannerRef} ></BannerIfANy>
| ^
Solution:
Remove your Typescript type to your function component:
BAD:
export const BannerIfAny: React.FunctionComponent<Props> = forwardRef((props: Props, ref: Ref<BannerRef>) => {
GOOD:
export const BannerIfAny = forwardRef((props: Props, ref: Ref<BannerRef>) => {
Thanks a lot!