react-relay 20.1.1 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/ReactRelayContext.js +1 -1
  2. package/ReactRelayContext.js.flow +2 -2
  3. package/ReactRelayFragmentContainer.js.flow +8 -9
  4. package/ReactRelayLocalQueryRenderer.js.flow +11 -3
  5. package/ReactRelayLoggingContext.js.flow +3 -3
  6. package/ReactRelayPaginationContainer.js.flow +31 -24
  7. package/ReactRelayQueryFetcher.js.flow +1 -1
  8. package/ReactRelayQueryRenderer.js.flow +2 -2
  9. package/ReactRelayQueryRendererContext.js.flow +2 -2
  10. package/ReactRelayRefetchContainer.js.flow +17 -14
  11. package/ReactRelayTestMocker.js.flow +10 -10
  12. package/ReactRelayTypes.js.flow +18 -20
  13. package/RelayContext.js.flow +3 -3
  14. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +11 -11
  15. package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +5 -5
  16. package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +5 -5
  17. package/__flowtests__/RelayModern-flowtest.js.flow +24 -27
  18. package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +1 -1
  19. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +3 -4
  20. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +3 -4
  21. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +9 -10
  22. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +4 -5
  23. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +9 -10
  24. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +4 -5
  25. package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +3 -4
  26. package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +3 -4
  27. package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +3 -4
  28. package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +5 -6
  29. package/buildReactRelayContainer.js.flow +4 -4
  30. package/getRootVariablesForFragments.js.flow +1 -1
  31. package/hooks.js +1 -1
  32. package/hooks.js.flow +23 -8
  33. package/index.js +1 -1
  34. package/index.js.flow +40 -14
  35. package/isRelayEnvironment.js.flow +1 -1
  36. package/jest-react/internalAct.js.flow +1 -1
  37. package/legacy.js +1 -1
  38. package/legacy.js.flow +32 -13
  39. package/lib/ReactRelayFragmentContainer.js +1 -1
  40. package/lib/ReactRelayPaginationContainer.js +8 -8
  41. package/lib/ReactRelayRefetchContainer.js +8 -8
  42. package/lib/ReactRelayTestMocker.js +5 -5
  43. package/lib/hooks.js +18 -8
  44. package/lib/index.js +30 -14
  45. package/lib/legacy.js +26 -13
  46. package/lib/relay-hooks/legacy/useBlockingPaginationFragment.js +5 -5
  47. package/lib/relay-hooks/legacy/useRefetchableFragmentNode.js +34 -34
  48. package/lib/relay-hooks/loadEntryPoint.js +2 -2
  49. package/lib/relay-hooks/loadQuery.js +14 -14
  50. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +10 -10
  51. package/lib/relay-hooks/readFragmentInternal.js +6 -6
  52. package/lib/relay-hooks/rsc/serverFetchQuery.js +20 -0
  53. package/lib/relay-hooks/rsc/serverPreloadQuery.js +31 -0
  54. package/lib/relay-hooks/rsc/serverReadFragment.js +15 -0
  55. package/lib/relay-hooks/rsc/useQueryFromServer.js +62 -0
  56. package/lib/relay-hooks/useFragmentInternal_CURRENT.js +49 -25
  57. package/lib/relay-hooks/useFragmentInternal_EXPERIMENTAL.js +81 -44
  58. package/lib/relay-hooks/useLazyLoadQueryNode.js +32 -19
  59. package/lib/relay-hooks/useMutation.js +6 -14
  60. package/lib/relay-hooks/useMutationAction_EXPERIMENTAL.js +26 -0
  61. package/lib/relay-hooks/usePreloadedQuery.js +52 -47
  62. package/lib/relay-hooks/useQueryLoader.js +2 -2
  63. package/lib/relay-hooks/useQueryLoader_EXPERIMENTAL.js +2 -2
  64. package/lib/relay-hooks/useRefetchableFragmentInternal.js +31 -31
  65. package/lib/rsc-client_EXPERIMENTAL.js +7 -0
  66. package/lib/rsc_EXPERIMENTAL.js +43 -0
  67. package/multi-actor/ActorChange.js.flow +1 -1
  68. package/package.json +3 -2
  69. package/relay-hooks/EntryPointContainer.react.js.flow +6 -6
  70. package/relay-hooks/EntryPointTypes.flow.js.flow +61 -67
  71. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +23 -21
  72. package/relay-hooks/MatchContainer.js.flow +12 -6
  73. package/relay-hooks/NestedRelayEntryPointBuilderUtils.js.flow +3 -9
  74. package/relay-hooks/QueryResource.js.flow +6 -6
  75. package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -2
  76. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +6 -6
  77. package/relay-hooks/__flowtests__/EntryPointTypes/ExtractQueryTypes-flowtest.js.flow +48 -1
  78. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +9 -9
  79. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +3 -4
  80. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +5 -6
  81. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +27 -32
  82. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +25 -25
  83. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +26 -32
  84. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +23 -30
  85. package/relay-hooks/__flowtests__/utils.js.flow +4 -4
  86. package/relay-hooks/getConnectionState.js.flow +2 -2
  87. package/relay-hooks/legacy/FragmentResource.js.flow +13 -13
  88. package/relay-hooks/legacy/useBlockingPaginationFragment.js.flow +24 -25
  89. package/relay-hooks/legacy/useFragmentNode.js.flow +4 -4
  90. package/relay-hooks/legacy/useRefetchableFragmentNode.js.flow +79 -81
  91. package/relay-hooks/loadEntryPoint.js.flow +15 -13
  92. package/relay-hooks/loadQuery.js.flow +18 -18
  93. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +16 -13
  94. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +7 -7
  95. package/relay-hooks/readFragmentInternal.js.flow +9 -9
  96. package/relay-hooks/rsc/serverFetchQuery.js.flow +31 -0
  97. package/relay-hooks/rsc/serverPreloadQuery.js.flow +69 -0
  98. package/relay-hooks/rsc/serverReadFragment.js.flow +33 -0
  99. package/relay-hooks/rsc/useQueryFromServer.js.flow +135 -0
  100. package/relay-hooks/useClientQuery.js.flow +2 -2
  101. package/relay-hooks/useEntryPointLoader.js.flow +11 -11
  102. package/relay-hooks/useFragment.js.flow +7 -7
  103. package/relay-hooks/useFragmentInternal.js.flow +1 -1
  104. package/relay-hooks/useFragmentInternal_CURRENT.js.flow +54 -22
  105. package/relay-hooks/useFragmentInternal_EXPERIMENTAL.js.flow +95 -46
  106. package/relay-hooks/useIsOperationNodeActive.js.flow +1 -1
  107. package/relay-hooks/useIsParentQueryActive.js.flow +1 -1
  108. package/relay-hooks/useLazyLoadQuery.js.flow +10 -3
  109. package/relay-hooks/useLazyLoadQueryNode.js.flow +67 -28
  110. package/relay-hooks/useLoadMoreFunction.js.flow +7 -6
  111. package/relay-hooks/useLoadMoreFunction_EXPERIMENTAL.js.flow +5 -5
  112. package/relay-hooks/useMemoVariables.js.flow +1 -1
  113. package/relay-hooks/useMutation.js.flow +8 -16
  114. package/relay-hooks/useMutationAction_EXPERIMENTAL.js.flow +68 -0
  115. package/relay-hooks/usePaginationFragment.js.flow +15 -11
  116. package/relay-hooks/usePrefetchableForwardPaginationFragment.js.flow +19 -18
  117. package/relay-hooks/usePrefetchableForwardPaginationFragment_EXPERIMENTAL.js.flow +19 -18
  118. package/relay-hooks/usePreloadedQuery.js.flow +119 -85
  119. package/relay-hooks/useQueryLoader.js.flow +27 -23
  120. package/relay-hooks/useQueryLoader_EXPERIMENTAL.js.flow +10 -10
  121. package/relay-hooks/useRefetchableFragment.js.flow +16 -11
  122. package/relay-hooks/useRefetchableFragmentInternal.js.flow +77 -79
  123. package/relay-hooks/useRelayLoggingContext.js.flow +1 -1
  124. package/relay-hooks/useSubscribeToInvalidationState.js.flow +1 -1
  125. package/relay-hooks/useSubscription.js.flow +1 -1
  126. package/rsc-client_EXPERIMENTAL.js +10 -0
  127. package/rsc-client_EXPERIMENTAL.js.flow +23 -0
  128. package/rsc_EXPERIMENTAL.js +10 -0
  129. package/rsc_EXPERIMENTAL.js.flow +90 -0
@@ -26,7 +26,7 @@ const React = require('react');
26
26
  const {useContext, useEffect, useMemo} = require('react');
27
27
  const {stableCopy} = require('relay-runtime');
28
28
 
29
- type PreloadedEntryPoint<TEntryPointComponent> = $ReadOnly<{
29
+ type PreloadedEntryPoint<TEntryPointComponent> = Readonly<{
30
30
  entryPoints: React.ElementConfig<TEntryPointComponent>['entryPoints'],
31
31
  extraProps: React.ElementConfig<TEntryPointComponent>['extraProps'],
32
32
  getComponent: () => TEntryPointComponent,
@@ -40,8 +40,8 @@ type EntryPointContainerProps<
40
40
  TPreloadedEntryPoints,
41
41
  TRuntimeProps,
42
42
  TExtraProps,
43
- > = $ReadOnly<
44
- $ReadOnly<{
43
+ > = Readonly<
44
+ Readonly<{
45
45
  entryPoint: EntryPoint<
46
46
  TEntryPointParams,
47
47
  EntryPointComponent<
@@ -57,24 +57,24 @@ type EntryPointContainerProps<
57
57
  }>,
58
58
  >;
59
59
 
60
- function stableStringify(value: mixed): string {
60
+ function stableStringify(value: unknown): string {
61
61
  return JSON.stringify(stableCopy(value)) ?? 'null';
62
62
  }
63
63
 
64
64
  function prepareEntryPoint<
65
- TEntryPointParams: {...},
65
+ TEntryPointParams extends {...},
66
66
  // $FlowExpectedError[unclear-type] Need any to make it supertype of all PreloadedQuery
67
- TPreloadedQueries: {+[string]: PreloadedQuery<any>},
68
- TPreloadedEntryPoints: {...},
69
- TRuntimeProps: {...},
67
+ TPreloadedQueries extends {+[string]: PreloadedQuery<any>},
68
+ TPreloadedEntryPoints extends {...},
69
+ TRuntimeProps extends {...},
70
70
  TExtraProps,
71
- TEntryPointComponent: EntryPointComponent<
71
+ TEntryPointComponent extends EntryPointComponent<
72
72
  TPreloadedQueries,
73
73
  TPreloadedEntryPoints,
74
74
  TRuntimeProps,
75
75
  TExtraProps,
76
76
  >,
77
- TEntryPoint: EntryPoint<TEntryPointParams, TEntryPointComponent>,
77
+ TEntryPoint extends EntryPoint<TEntryPointParams, TEntryPointComponent>,
78
78
  >(
79
79
  environmentProvider: IEnvironmentProvider<EnvironmentProviderOptions>,
80
80
  entryPoint: TEntryPoint,
@@ -104,7 +104,7 @@ function prepareEntryPoint<
104
104
  // $FlowFixMe[incompatible-type]
105
105
  preloadedQueries[queryPropName] = preloadQuery_DEPRECATED<
106
106
  OperationType,
107
- mixed,
107
+ unknown,
108
108
  >(
109
109
  environment,
110
110
  parameters,
@@ -129,14 +129,15 @@ function prepareEntryPoint<
129
129
  {},
130
130
  {...},
131
131
  {...},
132
- mixed,
133
- EntryPointComponent<{}, {...}, {...}, mixed>,
132
+ unknown,
133
+ EntryPointComponent<{}, {...}, {...}, unknown>,
134
134
  _,
135
135
  >(environmentProvider, nestedEntryPoint, nestedParams);
136
136
  });
137
137
  }
138
138
  return {
139
- entryPoints: (preloadedEntryPoints: TPreloadedEntryPoints),
139
+ // $FlowFixMe[incompatible-type]
140
+ entryPoints: preloadedEntryPoints as TPreloadedEntryPoints,
140
141
  extraProps: extraProps ?? null,
141
142
  getComponent: () => {
142
143
  const component = entryPoint.root.getModuleIfRequired();
@@ -144,20 +145,21 @@ function prepareEntryPoint<
144
145
  loadingPromise = loadingPromise ?? entryPoint.root.load();
145
146
  throw loadingPromise;
146
147
  }
147
- // $FlowFixMe[incompatible-cast] - trust me Flow, its entryPoint component
148
- return (component: TEntryPointComponent);
148
+ // $FlowFixMe[incompatible-type] - trust me Flow, its entryPoint component
149
+ return component as TEntryPointComponent;
149
150
  },
150
- queries: (preloadedQueries: TPreloadedQueries),
151
+ // $FlowFixMe[incompatible-type]
152
+ queries: preloadedQueries as TPreloadedQueries,
151
153
  rootModuleID: entryPoint.root.getModuleId(),
152
154
  };
153
155
  }
154
156
 
155
157
  function LazyLoadEntryPointContainer_DEPRECATED<
156
- TEntryPointParams: {...},
158
+ TEntryPointParams extends {...},
157
159
  // $FlowExpectedError[unclear-type] Need any to make it supertype of all PreloadedQuery
158
- TPreloadedQueries: {+[string]: PreloadedQuery<any>},
159
- TPreloadedEntryPoints: {...},
160
- TRuntimeProps: {...},
160
+ TPreloadedQueries extends {+[string]: PreloadedQuery<any>},
161
+ TPreloadedEntryPoints extends {...},
162
+ TRuntimeProps extends {...},
161
163
  TExtraProps,
162
164
  >({
163
165
  entryPoint,
@@ -88,19 +88,25 @@ const {useMemo} = React;
88
88
  type TypenameOnlyPointer = {+__typename: string};
89
89
  export type MatchPointer = {
90
90
  +__fragmentPropName?: ?string,
91
- +__module_component?: mixed,
92
- +$fragmentSpreads: mixed,
91
+ +__module_component?: unknown,
92
+ +$fragmentSpreads: unknown,
93
93
  ...
94
94
  };
95
95
 
96
- export type MatchContainerProps<TProps: {...}, TFallback: React.Node> = {
96
+ export type MatchContainerProps<
97
+ TProps extends {...},
98
+ TFallback extends React.Node,
99
+ > = {
97
100
  +fallback?: ?TFallback,
98
- +loader: (module: mixed) => component(...TProps),
101
+ +loader: (module: unknown) => component(...TProps),
99
102
  +match: ?MatchPointer | ?TypenameOnlyPointer,
100
103
  +props?: TProps,
101
104
  };
102
105
 
103
- function MatchContainer<TProps: {...}, TFallback: React.Node | null>({
106
+ function MatchContainer<
107
+ TProps extends {...},
108
+ TFallback extends React.Node | null,
109
+ >({
104
110
  fallback,
105
111
  loader,
106
112
  match,
@@ -127,7 +133,7 @@ function MatchContainer<TProps: {...}, TFallback: React.Node | null>({
127
133
  __fragmentOwner,
128
134
  __fragmentPropName,
129
135
  __module_component,
130
- } = (match: $FlowFixMe) ?? {};
136
+ } = (match as $FlowFixMe) ?? {};
131
137
  if (
132
138
  (__fragmentOwner != null && typeof __fragmentOwner !== 'object') ||
133
139
  (__fragmentPropName != null && typeof __fragmentPropName !== 'string') ||
@@ -12,7 +12,7 @@
12
12
  'use strict';
13
13
 
14
14
  import type {
15
- InternalEntryPointRepresentation,
15
+ EntryPoint,
16
16
  ThinNestedEntryPointParams,
17
17
  } from './EntryPointTypes.flow';
18
18
 
@@ -25,14 +25,8 @@ import type {
25
25
  * to construct a `ThinNestedEntryPointParams` is by calling this function.
26
26
  */
27
27
  declare function NestedRelayEntryPoint<TEntryPointParams>(
28
- $ReadOnly<{
29
- entryPoint: InternalEntryPointRepresentation<
30
- TEntryPointParams,
31
- $FlowFixMe,
32
- $FlowFixMe,
33
- $FlowFixMe,
34
- $FlowFixMe,
35
- >,
28
+ params: Readonly<{
29
+ entryPoint: EntryPoint<TEntryPointParams, $FlowFixMe>,
36
30
  entryPointParams: TEntryPointParams,
37
31
  }>,
38
32
  ): ThinNestedEntryPointParams;
@@ -58,12 +58,12 @@ type QueryResourceCacheEntry = {
58
58
  };
59
59
  export opaque type QueryResult: {
60
60
  fragmentNode: ReaderFragment,
61
- fragmentRef: mixed,
61
+ fragmentRef: unknown,
62
62
  ...
63
63
  } = {
64
64
  cacheIdentifier: string,
65
65
  fragmentNode: ReaderFragment,
66
- fragmentRef: mixed,
66
+ fragmentRef: unknown,
67
67
  operation: OperationDescriptor,
68
68
  };
69
69
 
@@ -206,7 +206,7 @@ class QueryResourceImpl {
206
206
  maybeRenderPolicy: ?RenderPolicy,
207
207
  observer: ?Observer<Snapshot>,
208
208
  cacheBreaker: ?string | ?number,
209
- profilerContext: mixed,
209
+ profilerContext: unknown,
210
210
  ): QueryResult {
211
211
  const cacheIdentifier = getQueryCacheIdentifier(
212
212
  this._environment,
@@ -238,7 +238,7 @@ class QueryResourceImpl {
238
238
  maybeFetchPolicy: ?FetchPolicy,
239
239
  maybeRenderPolicy: ?RenderPolicy,
240
240
  observer: ?Observer<Snapshot>,
241
- profilerContext: mixed,
241
+ profilerContext: unknown,
242
242
  ): QueryResult {
243
243
  const environment = this._environment;
244
244
  const fetchPolicy =
@@ -313,7 +313,7 @@ class QueryResourceImpl {
313
313
  * (e.g. inside useEffect), in order to retain the operation in the Relay store
314
314
  * and transfer ownership of the operation to the component lifecycle.
315
315
  */
316
- retain(queryResult: QueryResult, profilerContext: mixed): Disposable {
316
+ retain(queryResult: QueryResult, profilerContext: unknown): Disposable {
317
317
  const environment = this._environment;
318
318
  const {cacheIdentifier, operation} = queryResult;
319
319
  const cacheEntry = this._getOrCreateCacheEntry(
@@ -393,7 +393,7 @@ class QueryResourceImpl {
393
393
  fetchObservable: Observable<GraphQLResponse>,
394
394
  fetchPolicy: FetchPolicy,
395
395
  renderPolicy: RenderPolicy,
396
- profilerContext: mixed,
396
+ profilerContext: unknown,
397
397
  observer: Observer<Snapshot>,
398
398
  ): QueryResourceCacheEntry {
399
399
  const environment = this._environment;
@@ -22,7 +22,7 @@ const React = require('react');
22
22
 
23
23
  const {useMemo} = React;
24
24
 
25
- type Props<TChildren> = $ReadOnly<{
25
+ type Props<TChildren> = Readonly<{
26
26
  children: TChildren,
27
27
  environment: IEnvironment,
28
28
  getEnvironmentForActor?: ?(
@@ -30,7 +30,7 @@ type Props<TChildren> = $ReadOnly<{
30
30
  ) => IActorEnvironment,
31
31
  }>;
32
32
 
33
- component RelayEnvironmentProvider<TChildren: React.Node>(
33
+ component RelayEnvironmentProvider<TChildren extends React.Node>(
34
34
  ...props: Props<TChildren>
35
35
  ) renders TChildren {
36
36
  const {children, environment, getEnvironmentForActor} = props;
@@ -19,7 +19,7 @@ import type {
19
19
  EntryPointProps,
20
20
  } from '../../EntryPointTypes.flow';
21
21
 
22
- type MyComponentOtherProps = $ReadOnly<{
22
+ type MyComponentOtherProps = Readonly<{
23
23
  foo: string,
24
24
  }>;
25
25
 
@@ -27,7 +27,7 @@ type MyComponentProps = EntryPointProps<{}, {}, MyComponentOtherProps, {}>;
27
27
 
28
28
  const MyComponent = (_props: MyComponentProps) => null;
29
29
 
30
- type PreloadParams = $ReadOnly<{}>;
30
+ type PreloadParams = Readonly<{}>;
31
31
 
32
32
  type MyComponentEntryPointType = EntryPoint<PreloadParams, typeof MyComponent>;
33
33
 
@@ -42,9 +42,9 @@ type OtherProps = MyComponentProps['props'];
42
42
  opaque type __SUBTYPE_CHECK_1__: OtherProps = MyComponentEntryPointProps;
43
43
  opaque type __SUBTYPE_CHECK_2__: MyComponentEntryPointProps = OtherProps;
44
44
 
45
- ({foo: ''}: OtherProps);
45
+ ({foo: ''}) as OtherProps;
46
46
 
47
- ({foo: ''}: MyComponentEntryPointProps);
47
+ ({foo: ''}) as MyComponentEntryPointProps;
48
48
 
49
- // $FlowExpectedError[incompatible-cast]
50
- ({foo: null}: MyComponentEntryPointProps);
49
+ // $FlowExpectedError[incompatible-type]
50
+ ({foo: null}) as MyComponentEntryPointProps;
@@ -15,11 +15,13 @@ import type {
15
15
  EnvironmentProviderOptions,
16
16
  ExtractQueryTypes,
17
17
  PreloadedQuery,
18
+ ThinQueryParams,
18
19
  } from '../../EntryPointTypes.flow';
20
+ import type {OperationType} from 'relay-runtime';
19
21
 
20
22
  type Query = {
21
23
  +variables: {foo: string, bar: number},
22
- +response: mixed,
24
+ +response: unknown,
23
25
  +rawResponse?: {...},
24
26
  };
25
27
 
@@ -35,9 +37,54 @@ const _bad: ExtractQueryTypes<
35
37
  EnvironmentProviderOptions,
36
38
  {root: PreloadedQuery<Query>},
37
39
  // $FlowExpectedError[prop-missing]
40
+ // $FlowExpectedError[incompatible-type]
38
41
  >['root']['variables'] = {
39
42
  memebers_are_checked: true,
40
43
  // $FlowExpectedError[incompatible-type]
41
44
  foo: 1,
42
45
  bar: 3,
43
46
  };
47
+
48
+ declare type RootQuery = OperationType;
49
+
50
+ type ActualRequiredQueryType = ExtractQueryTypes<
51
+ EnvironmentProviderOptions,
52
+ {root: PreloadedQuery<RootQuery>},
53
+ >;
54
+
55
+ type ExpectedRequiredQueryType = {
56
+ root: ThinQueryParams<RootQuery, EnvironmentProviderOptions>,
57
+ };
58
+
59
+ declare const ActualRequiredQuery: ActualRequiredQueryType;
60
+ declare const ExpectedRequiredQuery: ExpectedRequiredQueryType;
61
+ ActualRequiredQuery as ExpectedRequiredQueryType;
62
+ ExpectedRequiredQuery as ActualRequiredQueryType;
63
+
64
+ type ActualOptionalQueryType = ExtractQueryTypes<
65
+ EnvironmentProviderOptions,
66
+ {root: PreloadedQuery<RootQuery> | void},
67
+ >;
68
+
69
+ type ExpectedOptionalQueryType = {
70
+ root: ThinQueryParams<RootQuery, EnvironmentProviderOptions> | void,
71
+ };
72
+
73
+ declare const ActualOptionalQuery: ActualOptionalQueryType;
74
+ declare const ExpectedOptionalQuery: ExpectedOptionalQueryType;
75
+ ActualOptionalQuery as ExpectedOptionalQueryType;
76
+ ExpectedOptionalQuery as ActualOptionalQueryType;
77
+
78
+ type ActualNullableQueryType = ExtractQueryTypes<
79
+ EnvironmentProviderOptions,
80
+ {root: PreloadedQuery<RootQuery> | void},
81
+ >;
82
+
83
+ type ExpectedNullableQueryType = {
84
+ root: ThinQueryParams<RootQuery, EnvironmentProviderOptions> | void,
85
+ };
86
+
87
+ declare const ActualNullableQuery: ActualNullableQueryType;
88
+ declare const ExpectedNullableQuery: ExpectedNullableQueryType;
89
+ ActualNullableQuery as ExpectedNullableQueryType;
90
+ ExpectedNullableQuery as ActualNullableQueryType;
@@ -29,7 +29,7 @@ type NestedEntrypointComponentProps = EntryPointProps<{}>;
29
29
  const NestedEntrypointComponent = (_props: NestedEntrypointComponentProps) =>
30
30
  null;
31
31
 
32
- type NestedEntrypointPreloadParams = $ReadOnly<{
32
+ type NestedEntrypointPreloadParams = Readonly<{
33
33
  subEntrypointPreloadParam: string,
34
34
  }>;
35
35
 
@@ -38,16 +38,16 @@ type NestedEntryPointType = EntryPoint<
38
38
  typeof NestedEntrypointComponent,
39
39
  >;
40
40
 
41
- const NestedEntryPoint = ({
41
+ const NestedEntryPoint = {
42
42
  getPreloadProps({subEntrypointPreloadParam: _subEntrypointPreloadParam}) {
43
43
  return {};
44
44
  },
45
45
  root: mockJSResource(NestedEntrypointComponent),
46
- }: NestedEntryPointType);
46
+ } as NestedEntryPointType;
47
47
 
48
48
  // Define the parent entrypoint's component
49
49
 
50
- type PreloadedEntrypoints = $ReadOnly<{
50
+ type PreloadedEntrypoints = Readonly<{
51
51
  nestedComponent: PreloadedEntryPoint<typeof NestedEntrypointComponent>,
52
52
  }>;
53
53
 
@@ -61,7 +61,7 @@ const ParentEntrypointComponent = (_props: ParentEntrypointComponentProps) =>
61
61
  * INCORRECT params passed into the nested entrypoints.
62
62
  */
63
63
 
64
- type BadParentEntrypointParams = $ReadOnly<{}>;
64
+ type BadParentEntrypointParams = Readonly<{}>;
65
65
 
66
66
  ({
67
67
  getPreloadProps(_params: BadParentEntrypointParams) {
@@ -69,7 +69,7 @@ type BadParentEntrypointParams = $ReadOnly<{}>;
69
69
  entryPoints: {
70
70
  nestedComponent: NestedRelayEntryPoint({
71
71
  /**
72
- $FlowExpectedError The entryPointParams here should be of type
72
+ $FlowExpectedError[incompatible-type] The entryPointParams here should be of type
73
73
  NestedEntrypointPreloadParams, but it does not contain subEntrypointPreloadParam
74
74
  */
75
75
  entryPoint: NestedEntryPoint,
@@ -79,14 +79,14 @@ type BadParentEntrypointParams = $ReadOnly<{}>;
79
79
  };
80
80
  },
81
81
  root: mockJSResource(ParentEntrypointComponent),
82
- }: EntryPoint<BadParentEntrypointParams, typeof ParentEntrypointComponent>);
82
+ }) as EntryPoint<BadParentEntrypointParams, typeof ParentEntrypointComponent>;
83
83
 
84
84
  /**
85
85
  * Create a parent entrypoint with the component with
86
86
  * CORRECT params passed into the nested entrypoints.
87
87
  */
88
88
 
89
- type GoodParentEntrypointParams = $ReadOnly<{}>;
89
+ type GoodParentEntrypointParams = Readonly<{}>;
90
90
 
91
91
  ({
92
92
  getPreloadProps(_params: GoodParentEntrypointParams) {
@@ -103,4 +103,4 @@ type GoodParentEntrypointParams = $ReadOnly<{}>;
103
103
  };
104
104
  },
105
105
  root: mockJSResource(ParentEntrypointComponent),
106
- }: EntryPoint<GoodParentEntrypointParams, typeof ParentEntrypointComponent>);
106
+ }) as EntryPoint<GoodParentEntrypointParams, typeof ParentEntrypointComponent>;
@@ -6,10 +6,9 @@
6
6
  *
7
7
  * @oncall relay
8
8
  *
9
- * @generated SignedSource<<fef9e96f393a59b2e761b70b1c3ddc50>>
9
+ * @generated SignedSource<<b0435066c8bc918fc030ba8ea4aebfb8>>
10
10
  * @flow
11
11
  * @lightSyntaxTransform
12
- * @nogrep
13
12
  */
14
13
 
15
14
  /* eslint-disable */
@@ -50,10 +49,10 @@ var node/*: ReaderFragment*/ = {
50
49
  };
51
50
 
52
51
  if (__DEV__) {
53
- (node/*: any*/).hash = "a0eb71a1bbfb0eb3a4c42fb5a69a7f81";
52
+ (node/*:: as any*/).hash = "a0eb71a1bbfb0eb3a4c42fb5a69a7f81";
54
53
  }
55
54
 
56
- module.exports = ((node/*: any*/)/*: Fragment<
55
+ module.exports = ((node/*:: as any*/)/*:: as Fragment<
57
56
  useFragmentFlowtest_user$fragmentType,
58
57
  useFragmentFlowtest_user$data,
59
58
  >*/);
@@ -6,10 +6,9 @@
6
6
  *
7
7
  * @oncall relay
8
8
  *
9
- * @generated SignedSource<<1bd343735be9917826ee3203cf6756c4>>
9
+ * @generated SignedSource<<310a5ea49f6836992f54da76b8f7afae>>
10
10
  * @flow
11
11
  * @lightSyntaxTransform
12
- * @nogrep
13
12
  */
14
13
 
15
14
  /* eslint-disable */
@@ -20,11 +19,11 @@
20
19
  import type { Fragment, ReaderFragment } from 'relay-runtime';
21
20
  import type { FragmentType } from "relay-runtime";
22
21
  declare export opaque type useFragmentFlowtest_users$fragmentType: FragmentType;
23
- export type useFragmentFlowtest_users$data = $ReadOnlyArray<{|
22
+ export type useFragmentFlowtest_users$data = ReadonlyArray<{|
24
23
  +id: string,
25
24
  +$fragmentType: useFragmentFlowtest_users$fragmentType,
26
25
  |}>;
27
- export type useFragmentFlowtest_users$key = $ReadOnlyArray<{
26
+ export type useFragmentFlowtest_users$key = ReadonlyArray<{
28
27
  +$data?: useFragmentFlowtest_users$data,
29
28
  +$fragmentSpreads: useFragmentFlowtest_users$fragmentType,
30
29
  ...
@@ -52,10 +51,10 @@ var node/*: ReaderFragment*/ = {
52
51
  };
53
52
 
54
53
  if (__DEV__) {
55
- (node/*: any*/).hash = "8b9b9b23494aec63a7cb96eed58ebcbc";
54
+ (node/*:: as any*/).hash = "8b9b9b23494aec63a7cb96eed58ebcbc";
56
55
  }
57
56
 
58
- module.exports = ((node/*: any*/)/*: Fragment<
57
+ module.exports = ((node/*:: as any*/)/*:: as Fragment<
59
58
  useFragmentFlowtest_users$fragmentType,
60
59
  useFragmentFlowtest_users$data,
61
60
  >*/);
@@ -30,8 +30,8 @@ import {
30
30
  } from './utils';
31
31
 
32
32
  type ExpectedReturnType<
33
- TRefetchVariables: Variables,
34
- TLoadMoreVariables: Variables,
33
+ TRefetchVariables extends Variables,
34
+ TLoadMoreVariables extends Variables,
35
35
  TFragmentData,
36
36
  > = {
37
37
  data: TFragmentData,
@@ -46,63 +46,58 @@ type ExpectedReturnType<
46
46
 
47
47
  // Nullability of returned data type is correct
48
48
  // $FlowFixMe[prop-missing]
49
- // $FlowFixMe[incompatible-cast]
49
+ // $FlowFixMe[incompatible-type]
50
50
  // $FlowFixMe[incompatible-exact]
51
51
  // $FlowFixMe[react-rule-hook]
52
- (useBlockingPaginationFragment(
52
+ useBlockingPaginationFragment(
53
53
  refetchableFragmentInput,
54
54
  keyNonNullable,
55
- ): ExpectedReturnType<QueryVariablesSubset, QueryVariables, NonNullableData>);
55
+ ) as ExpectedReturnType<QueryVariablesSubset, QueryVariables, NonNullableData>;
56
56
 
57
57
  // $FlowFixMe[react-rule-hook]
58
- (useBlockingPaginationFragment(
58
+ useBlockingPaginationFragment(
59
59
  refetchableFragmentInput,
60
60
  keyNullable,
61
- ): ExpectedReturnType<QueryVariables, QueryVariables, NullableData>);
61
+ ) as ExpectedReturnType<QueryVariables, QueryVariables, NullableData>;
62
62
 
63
- // $FlowExpectedError: can't cast nullable to non-nullable
64
63
  // $FlowFixMe[react-rule-hook]
65
- // $FlowFixMe[incompatible-cast]
66
- (useBlockingPaginationFragment(
64
+ // $FlowFixMe[incompatible-type] can't cast nullable to non-nullable
65
+ useBlockingPaginationFragment(
67
66
  refetchableFragmentInput,
68
67
  keyNullable,
69
- ): ExpectedReturnType<QueryVariables, QueryVariables, NonNullableData>);
68
+ ) as ExpectedReturnType<QueryVariables, QueryVariables, NonNullableData>;
70
69
 
71
- // $FlowExpectedError: actual type of returned data is correct
72
70
  // $FlowFixMe[react-rule-hook]
73
71
  // $FlowFixMe[incompatible-exact]
74
72
  // $FlowFixMe[prop-missing]
75
- // $FlowFixMe[incompatible-cast]
76
- (useBlockingPaginationFragment(
73
+ // $FlowFixMe[incompatible-type] actual type of returned data is correct
74
+ useBlockingPaginationFragment(
77
75
  refetchableFragmentInput,
78
- // $FlowExpectedError[incompatible-call]
76
+ // $FlowExpectedError[incompatible-type]
79
77
  keyAnotherNonNullable,
80
- ): ExpectedReturnType<QueryVariables, QueryVariablesSubset, NonNullableData>);
78
+ ) as ExpectedReturnType<QueryVariables, QueryVariablesSubset, NonNullableData>;
81
79
 
82
- // $FlowExpectedError[incompatible-call] `Example_user$fragmentType` is incompatible with `FragmentType`
80
+ // $FlowExpectedError[incompatible-type] `Example_user$fragmentType` is incompatible with `FragmentType`
83
81
  // $FlowFixMe[react-rule-hook]
84
- (useBlockingPaginationFragment(
82
+ useBlockingPaginationFragment(
85
83
  refetchableFragmentInput,
86
- // $FlowExpectedError[incompatible-call]
84
+ // $FlowExpectedError[incompatible-type]
87
85
  keyAnotherNullable,
88
- ): ExpectedReturnType<QueryVariables, QueryVariables, NullableData>);
86
+ ) as ExpectedReturnType<QueryVariables, QueryVariables, NullableData>;
89
87
 
90
- // $FlowExpectedError: Key should not be a user provided object
91
88
  // $FlowFixMe[react-rule-hook]
92
- // $FlowFixMe[prop-missing]
89
+ // $FlowFixMe[incompatible-type] Key should not be a user provided object
93
90
  // $FlowFixMe[cannot-resolve-name]
94
91
  useBlockingPaginationFragment(fragmentInput, {abc: 123});
95
92
 
96
- // $FlowExpectedError: Key should not be an empty object
97
93
  // $FlowFixMe[react-rule-hook]
98
- // $FlowFixMe[prop-missing]
94
+ // $FlowFixMe[incompatible-type] Key should not be an empty object
99
95
  // $FlowFixMe[cannot-resolve-name]
100
96
  useBlockingPaginationFragment(fragmentInput, {});
101
97
 
102
- // $FlowExpectedError: Key should be the `<name>$key` type from generated flow
103
98
  // $FlowFixMe[react-rule-hook]
104
- // $FlowFixMe[prop-missing]
105
- // $FlowFixMe[cannot-resolve-name]
99
+ // $FlowFixMe[incompatible-type]
100
+ // $FlowFixMe[cannot-resolve-name] Key should be the `<name>$key` type from generated flow
106
101
  useBlockingPaginationFragment(fragmentInput, fragmentData);
107
102
 
108
103
  // Refetch function options:
@@ -114,12 +109,12 @@ const {refetch} = useBlockingPaginationFragment(
114
109
  refetchableFragmentInput,
115
110
  keyNonNullable,
116
111
  );
117
- // $FlowExpectedError: internal option
112
+ // $FlowExpectedError[incompatible-type] : internal option
118
113
  refetch(variables, {
119
114
  __environment: environment,
120
115
  });
121
116
 
122
- // $FlowExpectedError: doesn't exist
117
+ // $FlowExpectedError[incompatible-type] : doesn't exist
123
118
  refetch(variables, {
124
119
  NON_EXIST: 'NON_EXIST',
125
120
  });
@@ -136,17 +131,17 @@ const {loadNext} = useBlockingPaginationFragment(
136
131
  // Accepts extraVariables
137
132
  loadNext(10, {
138
133
  // $FlowFixMe[prop-missing]
139
- // $FlowFixMe[incompatible-call]
134
+ // $FlowFixMe[incompatible-type]
140
135
  UNSTABLE_extraVariables: extraVariables,
141
136
  });
142
137
 
143
138
  // $FlowFixMe[prop-missing]
144
139
  loadNext(10, {
145
- // $FlowExpectedError: doesn't accept variables not available in the Flow type
140
+ // $FlowExpectedError[incompatible-type] : doesn't accept variables not available in the Flow type
146
141
  UNSTABLE_extraVariables: invalidVariables,
147
142
  });
148
143
 
149
- // $FlowExpectedError: doesn't exist
144
+ // $FlowExpectedError[incompatible-type] : doesn't exist
150
145
  loadNext(10, {
151
146
  UNSTABLE_foo: invalidVariables,
152
147
  });