Merge branch 'recompose-mapPropsStream' of https://github.com/mrapogee/DefinitelyTyped into mrapogee-recompose-mapPropsStream

This commit is contained in:
Andy Hanson
2017-06-02 06:45:18 -07:00
2 changed files with 21 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
// Type definitions for Recompose v0.22.1
// Type definitions for Recompose 0.23
// Project: https://github.com/acdlite/recompose
// Definitions by: Iskander Sierra <https://github.com/iskandersierra>
// Samuel DeSota <https://github.com/mrapogee>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -155,7 +156,7 @@ declare module 'recompose' {
[key: string]: React.ReactInstance
};
}
// lifecycle: https://github.com/acdlite/recompose/blob/master/docs/API.md#lifecycle
interface ReactLifeCycleFunctions<TProps, TState> {
componentWillMount?: (this: ReactLifeCycleFunctionsThisArguments<TProps, TState>) => void;
@@ -269,11 +270,21 @@ declare module 'recompose' {
propsToReactNode: mapper<Subscribable<TProps>, Subscribable<React.ReactNode>>
): Component<TProps>; // ???
// componentFromStreamWithConfig: https://github.com/acdlite/recompose/blob/master/docs/API.md#componentfromstreamwithconfig
export function componentFromStreamWithConfig(config: ObservableConfig): <TProps> (
propsToReactNode: mapper<Subscribable<TProps>, Subscribable<React.ReactNode>>
) => Component<TProps>
// mapPropsStream: https://github.com/acdlite/recompose/blob/master/docs/API.md#mapPropsStream
export function mapPropsStream<TInner, TOutter>(
transform: mapper<Subscribable<TOutter>, Subscribable<TInner>>
): ComponentEnhancer<TInner, TOutter>;
// mapPropsStreamWithConfig: https://github.com/acdlite/recompose/blob/master/docs/API.md#mappropsstreamwithconfig
export function mapPropsStreamWithConfig(config: ObservableConfig): <TInner, TOutter> (
transform: mapper<Subscribable<TOutter>, Subscribable<TInner>>
) => ComponentEnhancer<TInner, TOutter>;
// createEventHandler: https://github.com/acdlite/recompose/blob/master/docs/API.md#createEventHandler
type EventHandlerOf<T, TSubs extends Subscribable<T>> = {
handler: (value: T) => void;

View File

@@ -16,6 +16,7 @@ import {
createSink, componentFromProp, nest, hoistStatics,
// Observable utilities
componentFromStream, mapPropsStream, createEventHandler,
componentFromStreamWithConfig, mapPropsStreamWithConfig,
setObservableConfig,
} from "recompose";
import rxjsconfig from "recompose/rxjsObservableConfig";
@@ -179,3 +180,10 @@ function testRenderComponent() {
const enhanced: React.ComponentClass<OutterProps> = enhancer(innerComponent);
}
function testWithObservableConfig() {
let componentFromStreamMost = componentFromStreamWithConfig(mostConfig)
componentFromStreamMost = componentFromStream
let mapPropsStreamMost = mapPropsStreamWithConfig(mostConfig)
mapPropsStreamMost = mapPropsStream
}