From b98c5d86b637af5737df5eca419d80da9d779cbf Mon Sep 17 00:00:00 2001 From: Andrew Prifer <2991360+AndrewPrifer@users.noreply.github.com> Date: Tue, 28 Jun 2022 17:06:55 +0200 Subject: [PATCH] Fix editable TS (#235) Fix primitive not being supported by the typings --- packages/r3f/src/main/editable.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/r3f/src/main/editable.tsx b/packages/r3f/src/main/editable.tsx index 34969e9..2e28e97 100644 --- a/packages/r3f/src/main/editable.tsx +++ b/packages/r3f/src/main/editable.tsx @@ -168,6 +168,23 @@ const createEditable = ( } & React.RefAttributes > > + } & { + primitive: React.ForwardRefExoticComponent< + React.PropsWithoutRef< + { + object: any + uniqueName: string + visible?: boolean | 'editor' + additionalProps?: $FixMe + objRef?: $FixMe + editableType: keyof JSX.IntrinsicElements + } & React.RefAttributes + > & { + // 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)