Skip to content

Instantly share code, notes, and snippets.

@lanwin
Created August 16, 2018 06:22
Show Gist options
  • Save lanwin/67ab9a1e6fd89dfb32eda525d4cd0def to your computer and use it in GitHub Desktop.
Save lanwin/67ab9a1e6fd89dfb32eda525d4cd0def to your computer and use it in GitHub Desktop.
declare module "react-copy-write" {
interface ConsumerProps<TState> {
select?: any;
children: (store: TState) => any;
}
interface ISelector<TState, TRet> {
select: (store: TState) => TRet;
}
class Consumer<T> extends Component<ConsumerProps<T>> {}
interface IState<TState> {
Consumer: new () => Consumer<TState>;
createSelector<TRet>(
selector: (state: TState) => TRet
): ISelector<TState, TRet>;
createConsumer<TState, T1>(
selector1: ISelector<TState, T1>
): new () => Consumer<T1>;
createConsumer<TState, T1, T2>(
selector1: ISelector<TState, T1>,
selector2: ISelector<TState, T2>
): new () => Consumer<T1 & T2>;
}
export function createStore<TState>(state: TState): IState<TState>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment