index.d.ts 549 B

123456789101112131415161718192021222324
  1. import * as React from 'react';
  2. export default function createReactContext<T>(
  3. defaultValue: T,
  4. calculateChangedBits?: (prev: T, next: T) => number
  5. ): Context<T>;
  6. type RenderFn<T> = (value: T) => React.ReactNode;
  7. export type Context<T> = {
  8. Provider: React.ComponentClass<ProviderProps<T>>;
  9. Consumer: React.ComponentClass<ConsumerProps<T>>;
  10. };
  11. export type ProviderProps<T> = {
  12. value: T;
  13. children?: React.ReactNode;
  14. observedBits?: any,
  15. };
  16. export type ConsumerProps<T> = {
  17. children: RenderFn<T> | [RenderFn<T>];
  18. observedBits?: number;
  19. };