Add typedef for react.createContext

This commit is contained in:
2018-04-08 12:10:07 +05:30
parent 9a7e983e9a
commit 72f38b59bc
+17
View File
@@ -0,0 +1,17 @@
import * as React from "react";
declare module "react" {
type Provider<T> = React.ComponentType<{
value: T;
children?: ReactNode;
}>;
type Consumer<T> = ComponentType<{
children: (value: T) => ReactNode;
unstable_observedBits?: number;
}>;
interface Context<T> {
Provider: Provider<T>;
Consumer: Consumer<T>;
}
function createContext<T>(defaultValue: T, calculateChangedBits?: (prev: T, next: T) => number): Context<T>;
}