Skip to content

Commit f09711c

Browse files
committed
fix: this maybe the global object
1 parent 93d8471 commit f09711c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function styled<Tag extends React.ElementType, Variants>(
9696
tag: Tag = 'div' as Tag,
9797
{ shouldForwardProp = isPropValid, ...config }: StyledOptions & StyleConfig<Variants> = {},
9898
) {
99-
const tw = this || defaultTW
99+
const tw = typeof this == 'function' ? this : defaultTW
100100

101101
const component = style(config)
102102

@@ -114,7 +114,7 @@ export function styled<Tag extends React.ElementType, Variants>(
114114

115115
const sc = React.forwardRef(
116116
<T extends React.ElementType = Tag>(
117-
{ as = (tag as unknown) as T, ...props }: PolymorphicPropsWithRef<StyleProps<Variants>, T>,
117+
{ as = tag as unknown as T, ...props }: PolymorphicPropsWithRef<StyleProps<Variants>, T>,
118118
ref: React.ForwardedRef<any>,
119119
) =>
120120
React.createElement(as, {

0 commit comments

Comments
 (0)