1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export type ReactNode =
|
11 | | React$Element<any>
|
12 | | ReactPortal
|
13 | | ReactText
|
14 | | ReactFragment
|
15 | | ReactProvider<any>
|
16 | | ReactConsumer<any>;
|
17 |
|
18 | export type ReactEmpty = null | void | boolean;
|
19 |
|
20 | export type ReactFragment = ReactEmpty | Iterable<React$Node>;
|
21 |
|
22 | export type ReactNodeList = ReactEmpty | React$Node;
|
23 |
|
24 | export type ReactText = string | number;
|
25 |
|
26 | export type ReactProvider<T> = {
|
27 | $$typeof: Symbol | number,
|
28 | type: ReactProviderType<T>,
|
29 | key: null | string,
|
30 | ref: null,
|
31 | props: {
|
32 | value: T,
|
33 | children?: ReactNodeList,
|
34 | },
|
35 | };
|
36 |
|
37 | export type ReactProviderType<T> = {
|
38 | $$typeof: Symbol | number,
|
39 | _context: ReactContext<T>,
|
40 | };
|
41 |
|
42 | export type ReactConsumer<T> = {
|
43 | $$typeof: Symbol | number,
|
44 | type: ReactContext<T>,
|
45 | key: null | string,
|
46 | ref: null,
|
47 | props: {
|
48 | children: (value: T) => ReactNodeList,
|
49 | unstable_observedBits?: number,
|
50 | },
|
51 | };
|
52 |
|
53 | export type ReactContext<T> = {
|
54 | $$typeof: Symbol | number,
|
55 | Consumer: ReactContext<T>,
|
56 | Provider: ReactProviderType<T>,
|
57 |
|
58 | _calculateChangedBits: ((a: T, b: T) => number) | null,
|
59 |
|
60 | _currentValue: T,
|
61 | _currentValue2: T,
|
62 | _threadCount: number,
|
63 |
|
64 |
|
65 | _currentRenderer?: Object | null,
|
66 | _currentRenderer2?: Object | null,
|
67 | };
|
68 |
|
69 | export type ReactPortal = {
|
70 | $$typeof: Symbol | number,
|
71 | key: null | string,
|
72 | containerInfo: any,
|
73 | children: ReactNodeList,
|
74 |
|
75 | implementation: any,
|
76 | };
|
77 |
|
78 | export type RefObject = {|
|
79 | current: any,
|
80 | |};
|
81 |
|
82 | export type ReactEventResponderInstance<E, C> = {|
|
83 | fiber: Object,
|
84 | props: Object,
|
85 | responder: ReactEventResponder<E, C>,
|
86 | rootEventTypes: null | Set<string>,
|
87 | state: Object,
|
88 | target: mixed,
|
89 | |};
|
90 |
|
91 | export type ReactEventResponderListener<E, C> = {|
|
92 | props: Object,
|
93 | responder: ReactEventResponder<E, C>,
|
94 | |};
|
95 |
|
96 | export type ReactEventResponder<E, C> = {
|
97 | $$typeof: Symbol | number,
|
98 | displayName: string,
|
99 | targetEventTypes: null | Array<string>,
|
100 | rootEventTypes: null | Array<string>,
|
101 | getInitialState: null | ((props: Object) => Object),
|
102 | onEvent:
|
103 | | null
|
104 | | ((event: E, context: C, props: Object, state: Object) => void),
|
105 | onRootEvent:
|
106 | | null
|
107 | | ((event: E, context: C, props: Object, state: Object) => void),
|
108 | onMount: null | ((context: C, props: Object, state: Object) => void),
|
109 | onUnmount: null | ((context: C, props: Object, state: Object) => void),
|
110 | onOwnershipChange:
|
111 | | null
|
112 | | ((context: C, props: Object, state: Object) => void),
|
113 | };
|
114 |
|
115 | export type EventPriority = 0 | 1 | 2;
|
116 |
|
117 | export const DiscreteEvent: EventPriority = 0;
|
118 | export const UserBlockingEvent: EventPriority = 1;
|
119 | export const ContinuousEvent: EventPriority = 2;
|
120 |
|
121 | export type ReactFundamentalComponentInstance<C, H> = {|
|
122 | currentFiber: mixed,
|
123 | instance: mixed,
|
124 | prevProps: null | Object,
|
125 | props: Object,
|
126 | impl: ReactFundamentalImpl<C, H>,
|
127 | state: Object,
|
128 | |};
|
129 |
|
130 | export type ReactFundamentalImpl<C, H> = {
|
131 | displayName: string,
|
132 | reconcileChildren: boolean,
|
133 | getInitialState?: (props: Object) => Object,
|
134 | getInstance: (context: C, props: Object, state: Object) => H,
|
135 | getServerSideString?: (context: C, props: Object) => string,
|
136 | getServerSideStringClose?: (context: C, props: Object) => string,
|
137 | onMount: (context: C, instance: mixed, props: Object, state: Object) => void,
|
138 | shouldUpdate?: (
|
139 | context: C,
|
140 | prevProps: null | Object,
|
141 | nextProps: Object,
|
142 | state: Object,
|
143 | ) => boolean,
|
144 | onUpdate?: (
|
145 | context: C,
|
146 | instance: mixed,
|
147 | prevProps: null | Object,
|
148 | nextProps: Object,
|
149 | state: Object,
|
150 | ) => void,
|
151 | onUnmount?: (
|
152 | context: C,
|
153 | instance: mixed,
|
154 | props: Object,
|
155 | state: Object,
|
156 | ) => void,
|
157 | onHydrate?: (context: C, props: Object, state: Object) => boolean,
|
158 | onFocus?: (context: C, props: Object, state: Object) => boolean,
|
159 | };
|
160 |
|
161 | export type ReactFundamentalComponent<C, H> = {|
|
162 | $$typeof: Symbol | number,
|
163 | impl: ReactFundamentalImpl<C, H>,
|
164 | |};
|