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
/** * This is a hack for sure. The thing is, getting a component to intelligently * infer props based on a component or JSX string passed into an `as` prop is * kind of a huge pain. Getting it to work and satisfy the constraints of * `forwardRef` seems dang near impossible. To avoid needing to do this awkward * type song-and-dance every time we want to forward a ref into a component * that accepts an `as` prop, we abstract all of that mess to this function for * the time time being. * * TODO: Eventually we should probably just try to get the type defs above * working across the board, but ain't nobody got time for that mess! * * @param Comp */exportfunctionforwardRefWithAs<Props,ComponentTypeextendsAs>(comp: (props: PropsFromAs<ComponentType,Props>,ref: React.RefObject<any>)=>React.ReactElement|null){return(React.forwardRef(compasany)asunknown)asComponentWithAs<ComponentType,Props>;}
The text was updated successfully, but these errors were encountered:
* wip: helper to write system components
#102
* make system typings smore consistent
* use system helper inside <Box>
* hide forwardref API 🤫
* add variant prop and docs
Reach-UI has incredible typings. We could steal + adapt the following typings for us to make creating components easier regarding typings:
https://github.com/reach/reach-ui/blob/4cb497f530b0f83f80c6f6f2da46ab55b1160cb6/packages/utils/src/index.tsx#L185-L209
The text was updated successfully, but these errors were encountered: