Flow fixes
Brian Vaughn committed
Aug 20, 2019 at 13:33 UTC
66c9fedc34614bd95cba342e07b7ff6cddf2e5e6
3 files changed
+12
-5
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementContext.js
+1
-1
@@ -135,7 +135,7 @@ function InspectedElementContextController({children}: Props) {
135
const value = hydrateHelper(data.value, data.path);
136
const inspectedElement = {...currentlyInspectedElement};
137
138
- fillInPath(inspectedElement, data.path, value);
138
+ fillInPath(inspectedElement, data.value, data.path, value);
139
140
resource.write(element, inspectedElement);
141
packages/react-devtools-shared/src/devtools/views/Components/types.js
+7
-2
@@ -1,6 +1,9 @@
1
// @flow
2
3
-import type {Dehydrated} from 'react-devtools-shared/src/hydration';
3
+import type {
4
+ Dehydrated,
5
+ Unserializable,
6
+} from 'react-devtools-shared/src/hydration';
7
import type {ElementType} from 'react-devtools-shared/src/types';
8
9
// Each element on the frontend corresponds to a Fiber on the backend.
@@ -87,7 +90,9 @@ export type DehydratedData = {|
90
data:
91
| string
92
| Dehydrated
93
+ | Unserializable
94
| Array<Dehydrated>
91
- | {[key: string]: string | Dehydrated},
95
+ | Array<Unserializable>
96
+ | {[key: string]: string | Dehydrated | Unserializable},
97
unserializable: Array<Array<string | number>>,
98
|};
packages/react-devtools-shared/src/hydration.js
+4
-2
@@ -42,7 +42,7 @@ export type Dehydrated = {|
42
// These objects can't be serialized without losing type information,
43
// so a "Unserializable" type wrapper is used (with meta-data keys) to send nested values-
44
// while preserving the original type and name.
45
-type Unserializable = {
45
+export type Unserializable = {
46
name: string | null,
47
readonly?: boolean,
48
size?: number,
@@ -196,6 +196,8 @@ export function dehydrate(
196
| string
197
| Dehydrated
198
| Unserializable
199
+ | Array<Dehydrated>
200
+ | Array<Unserializable>
201
| {[key: string]: string | Dehydrated | Unserializable} {
202
const type = getDataType(data);
203
@@ -380,7 +382,7 @@ export function fillInPath(
382
}
383
384
export function hydrate(
383
- object: Object,
385
+ object: any,
386
cleaned: Array<Array<string | number>>,
387
unserializable: Array<Array<string | number>>,
388
): Object {