Skip to content

Commit 59318dd

Browse files
committed
Fix types issues with EqualityFn and ICEnhancerWithProps
1 parent f580e0e commit 59318dd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/types.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { NonReactStatics } from 'hoist-non-react-statics'
1010

1111
export type FixTypeLater = any
1212

13-
export type EqualityFn<T> = (a: T | undefined, b: T | undefined) => boolean
13+
export type EqualityFn<T> = (a: T, b: T) => boolean
1414

1515
/**
1616
* This interface can be augmented by users to add default types for the root state when
@@ -85,6 +85,13 @@ export type GetProps<C> = C extends ComponentType<infer P>
8585
: P
8686
: never
8787

88+
// Applies LibraryManagedAttributes (proper handling of defaultProps
89+
// and propTypes).
90+
export type GetLibraryManagedProps<C> = JSX.LibraryManagedAttributes<
91+
C,
92+
GetProps<C>
93+
>
94+
8895
// Applies LibraryManagedAttributes (proper handling of defaultProps
8996
// and propTypes), as well as defines WrappedComponent.
9097
export type ConnectedComponent<
@@ -105,7 +112,10 @@ export type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = <
105112
component: C
106113
) => ConnectedComponent<
107114
C,
108-
DistributiveOmit<GetProps<C>, keyof Shared<TInjectedProps, GetProps<C>>> &
115+
DistributiveOmit<
116+
GetLibraryManagedProps<C>,
117+
keyof Shared<TInjectedProps, GetLibraryManagedProps<C>>
118+
> &
109119
TNeedsProps
110120
>
111121

0 commit comments

Comments
 (0)