Skip to content

Commit 774a94b

Browse files
vjeuxzpao
authored andcommitted
Type ReactComponentTreeHook (#7504)
For this one, I wanted to type a non-trivial piece of the codebase and ran into the fact that we do not have types for ReactElement nor ReactInstance, so I had to create them. I'll add comments inline (cherry picked from commit ea494a2)
1 parent 283dbc3 commit 774a94b

File tree

3 files changed

+199
-121
lines changed

3 files changed

+199
-121
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright 2016-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @flow
10+
* @providesModule ReactElementType
11+
*/
12+
13+
'use strict';
14+
15+
import type { ReactInstance } from 'ReactInstanceType';
16+
17+
export type Source = {
18+
fileName: string,
19+
lineNumber: number,
20+
};
21+
22+
export type ReactElement = {
23+
$$typeof: any,
24+
type: any,
25+
key: any,
26+
ref: any,
27+
props: any,
28+
_owner: ReactInstance,
29+
30+
// __DEV__
31+
_store: {
32+
validated: bool,
33+
},
34+
_self: ReactElement,
35+
_shadowChildren: any,
36+
_source: Source,
37+
};

0 commit comments

Comments
 (0)