Skip to content

Commit

Permalink
fix: this maybe the global object
Browse files Browse the repository at this point in the history
  • Loading branch information
sastan committed Mar 6, 2021
1 parent 93d8471 commit f09711c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export function styled<Tag extends React.ElementType, Variants>(
tag: Tag = 'div' as Tag,
{ shouldForwardProp = isPropValid, ...config }: StyledOptions & StyleConfig<Variants> = {},
) {
const tw = this || defaultTW
const tw = typeof this == 'function' ? this : defaultTW

const component = style(config)

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

const sc = React.forwardRef(
<T extends React.ElementType = Tag>(
{ as = (tag as unknown) as T, ...props }: PolymorphicPropsWithRef<StyleProps<Variants>, T>,
{ as = tag as unknown as T, ...props }: PolymorphicPropsWithRef<StyleProps<Variants>, T>,
ref: React.ForwardedRef<any>,
) =>
React.createElement(as, {
Expand Down

0 comments on commit f09711c

Please # to comment.