diff --git a/index.ts b/index.ts index 72c74ce..dfd5096 100644 --- a/index.ts +++ b/index.ts @@ -96,7 +96,7 @@ export function styled( tag: Tag = 'div' as Tag, { shouldForwardProp = isPropValid, ...config }: StyledOptions & StyleConfig = {}, ) { - const tw = this || defaultTW + const tw = typeof this == 'function' ? this : defaultTW const component = style(config) @@ -114,7 +114,7 @@ export function styled( const sc = React.forwardRef( ( - { as = (tag as unknown) as T, ...props }: PolymorphicPropsWithRef, T>, + { as = tag as unknown as T, ...props }: PolymorphicPropsWithRef, T>, ref: React.ForwardedRef, ) => React.createElement(as, {