import React, { type FunctionComponent } from 'react'; // tour prop is intentionally permissive — it will be spread onto // native components. We allow a nullable ref and any additional keys. interface TourType { ref?: React.RefObject | null; onLayout?: () => void; [key: string]: any; } export function walkthroughable

( WrappedComponent: React.ComponentType

) { // The returned component intentionally accepts arbitrary props because // tests and consumers may pass test-only props which should be forwarded // to the wrapped native component. const Component: FunctionComponent = (props: any) => { const { tour, ...rest } = props as { tour?: TourType } & P; return ; }; Component.displayName = 'Walkthroughable'; return Component; }