macaron-css / macaron

Compiler-augmented typesafe CSS-in-JS with zero runtime, colocation, maximum safety and productivity
https://macaron.js.org/
MIT License
749 stars 16 forks source link

styled first parameter needs extended typing #35

Closed dugip closed 1 year ago

dugip commented 1 year ago

As it stands right now, you can't style components that use a forwardRef wrapper, which forced me to cast them to any.

Example

const MyForwardRefComponent = React.forwardRef((props, ref) => <h1 ref={ref}>Hello World</h1>);

// does not work
const StyledMyForwardRefComponent1 = styled(MyForwardRefComponent, {...});

// does work
const StyledMyForwardRefComponent2 = styled(MyForwardRefComponent as any, {...});

Would appreciate if this received a fix.

Mokshit06 commented 1 year ago

Will fix this!

Mokshit06 commented 1 year ago

Should be fixed in v1.2.1. Thanks for reporting.