Skip to content

Commit

Permalink
Fix untyped event handler callbacks (#4086)
Browse files Browse the repository at this point in the history
* distribute PolymorphicComponent types

* use NoInfer type instead of introducing a new type for PolymorphicComponentProps
  • Loading branch information
ziolekjj committed Jul 13, 2023
1 parent 74cddae commit d12b700
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/styled-components/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,15 @@ export type PolymorphicComponentProps<
ForwardedAsTargetProps extends object = ForwardedAsTarget extends KnownTarget
? React.ComponentPropsWithoutRef<ForwardedAsTarget>
: {}
> = FastOmit<
Substitute<
BaseProps,
// "as" wins over "forwardedAs" when it comes to prop interface
Substitute<ForwardedAsTargetProps, AsTargetProps>
>,
keyof ExecutionProps
> = NoInfer<
FastOmit<
Substitute<
BaseProps,
// "as" wins over "forwardedAs" when it comes to prop interface
Substitute<ForwardedAsTargetProps, AsTargetProps>
>,
keyof ExecutionProps
>
> &
FastOmit<ExecutionProps, 'as' | 'forwardedAs'> & {
as?: AsTarget;
Expand Down

0 comments on commit d12b700

Please sign in to comment.