diff --git a/recompose/index.d.ts b/recompose/index.d.ts index e72302415f..3ff504fab3 100644 --- a/recompose/index.d.ts +++ b/recompose/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Recompose v0.20.2 +// Type definitions for Recompose v0.20.3 // Project: https://github.com/acdlite/recompose // Definitions by: Iskander Sierra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -103,7 +103,7 @@ declare module 'recompose' { export function branch( test: predicate, trueEnhancer: InferableComponentEnhancer, - falseEnhancer: InferableComponentEnhancer + falseEnhancer?: InferableComponentEnhancer ): ComponentEnhancer; // renderComponent: https://github.com/acdlite/recompose/blob/master/docs/API.md#renderComponent diff --git a/recompose/recompose-tests.tsx b/recompose/recompose-tests.tsx index 25b52d70b0..c4c66b3e2c 100644 --- a/recompose/recompose-tests.tsx +++ b/recompose/recompose-tests.tsx @@ -148,13 +148,19 @@ function testBranch() { const innerComponent: React.StatelessComponent = (props: InnerProps) =>
props.update()}>{props.count}
; + const innerComponent2 = () =>
Hello
; const enhancer = branch( (props: OutterProps) => props.toggled, withState("count", "update", 0), withState("count", "update", 100) ); + const enhancer2 = branch( + (props: OutterProps) => props.toggled, + renderComponent(innerComponent), + ) const enhanced: React.ComponentClass = enhancer(innerComponent); + const enhanced2: React.ComponentClass = enhancer2(innerComponent); } function testRenderComponent() {