mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
recompose: Support OuterProps on withState enhancer (#27263)
* Support OuterProps on withState enhancer Without this, any outer prop types are not handed into the component. * Add tests withState with explicit outer types
This commit is contained in:
parent
b92d9cfc1f
commit
cd23add574
2
types/recompose/index.d.ts
vendored
2
types/recompose/index.d.ts
vendored
@ -141,7 +141,7 @@ declare module 'recompose' {
|
||||
stateUpdaterName: TStateUpdaterName,
|
||||
initialState: TState | mapper<TOutter, TState>
|
||||
): InferableComponentEnhancerWithProps<
|
||||
stateProps<TState, TStateName, TStateUpdaterName>,
|
||||
TOutter & stateProps<TState, TStateName, TStateUpdaterName>,
|
||||
TOutter
|
||||
>;
|
||||
|
||||
|
||||
@ -256,6 +256,15 @@ function testWithState() {
|
||||
const rendered2 = (
|
||||
<Enhanced2 title="foo" />
|
||||
);
|
||||
|
||||
// We can also actually provide the generic necessary
|
||||
const enhancer3 = withState<OutterProps, number, "count", "setCount">("count", "setCount", 1);
|
||||
const Enhanced3 = enhancer3(props => {
|
||||
return <div>{props.title}</div>;
|
||||
});
|
||||
const rendered3 = (
|
||||
<Enhanced3 title="foo" />
|
||||
);
|
||||
}
|
||||
|
||||
function testWithStateHandlers() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user