mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #14471 from vsaarinen/recompose-optional-second-branch-parameter
recompose: Third parameter to branch() should be optional
This commit is contained in:
Vendored
+2
-2
@@ -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 <https://github.com/iskandersierra>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -103,7 +103,7 @@ declare module 'recompose' {
|
||||
export function branch<TOutter>(
|
||||
test: predicate<TOutter>,
|
||||
trueEnhancer: InferableComponentEnhancer,
|
||||
falseEnhancer: InferableComponentEnhancer
|
||||
falseEnhancer?: InferableComponentEnhancer
|
||||
): ComponentEnhancer<any, TOutter>;
|
||||
|
||||
// renderComponent: https://github.com/acdlite/recompose/blob/master/docs/API.md#renderComponent
|
||||
|
||||
@@ -148,13 +148,19 @@ function testBranch() {
|
||||
|
||||
const innerComponent: React.StatelessComponent<InnerProps> = (props: InnerProps) =>
|
||||
<div onClick={() => props.update()}>{props.count}</div>;
|
||||
const innerComponent2 = () => <div>Hello</div>;
|
||||
|
||||
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<OutterProps> = enhancer(innerComponent);
|
||||
const enhanced2: React.ComponentClass<OutterProps> = enhancer2(innerComponent);
|
||||
}
|
||||
|
||||
function testRenderComponent() {
|
||||
|
||||
Reference in New Issue
Block a user