Fix editable TS (#235)

Fix primitive not being supported by the typings
This commit is contained in:
Andrew Prifer 2022-06-28 17:06:55 +02:00 committed by GitHub
parent 006121da91
commit b98c5d86b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,6 +168,23 @@ const createEditable = <Keys extends keyof JSX.IntrinsicElements>(
} & React.RefAttributes<JSX.IntrinsicElements[Property]>
>
>
} & {
primitive: React.ForwardRefExoticComponent<
React.PropsWithoutRef<
{
object: any
uniqueName: string
visible?: boolean | 'editor'
additionalProps?: $FixMe
objRef?: $FixMe
editableType: keyof JSX.IntrinsicElements
} & React.RefAttributes<JSX.IntrinsicElements['primitive']>
> & {
// Have to reproduce the primitive component's props here because we need to
// lift this index type here to the outside to make auto-complete work
[props: string]: any
}
>
}
return Object.assign(editable, extensions)