You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moved to an issue since its been ~4 months without any update.
Originally posted by angeloanan March 12, 2022
Hi,
I would like to use a custom Typescript type for the render method of a Headless Tippy Singleton. Here is an example code:
importTippy,{useSingleton}from'@tippyjs/react'interfaceCustomRenderDataType{some: stringdata: string[]}constcustomDataToPass: CustomRenderDataType={some: 'custom',data: ['type']}constSomething=()=>{const[source,target]=useSingleton({overrides: ['render']})return(<><Tippysingleton={source}render={(attrs,content)=><SomeComponentattr={attrs}data={content}/>}/>{/* ^ I want this to have a custom type! */}{/* In here, Typescript complains that ReactNode (`content`) is not assignable to type 'CustomRenderDataType'! */}<Tippysingleton={target}content={customDataToPass}/>{/* ^ Typescript allows this but technically should be disallowed since CustomRenderDataType != React.ReactNode */}</>)}// Example render Component that takes in a custom typeconstSomeComponent=({ attr, data }: {attr: unknown;data: CustomRenderDataType})=>{// TODOreturn<></>}
Is there a way to do it as of now?
The text was updated successfully, but these errors were encountered:
Discussed in #355
Moved to an issue since its been ~4 months without any update.
Originally posted by angeloanan March 12, 2022
Hi,
I would like to use a custom Typescript type for the render method of a Headless Tippy Singleton. Here is an example code:
Is there a way to do it as of now?
The text was updated successfully, but these errors were encountered: