react-relay 20.1.1 → 21.0.1

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 (154) 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 +32 -25
  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.d.ts +377 -0
  13. package/ReactRelayTypes.js.flow +47 -43
  14. package/RelayContext.js.flow +3 -3
  15. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +11 -11
  16. package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +5 -5
  17. package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +5 -5
  18. package/__flowtests__/RelayModern-flowtest.js.flow +32 -32
  19. package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +1 -1
  20. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +3 -4
  21. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +3 -4
  22. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +9 -10
  23. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +4 -5
  24. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +9 -10
  25. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +4 -5
  26. package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +3 -4
  27. package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +3 -4
  28. package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +3 -4
  29. package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +5 -6
  30. package/buildReactRelayContainer.js.flow +5 -5
  31. package/getRootVariablesForFragments.js.flow +1 -1
  32. package/hooks.d.ts +89 -0
  33. package/hooks.js +1 -1
  34. package/hooks.js.flow +23 -8
  35. package/index.d.ts +9 -0
  36. package/index.js +1 -1
  37. package/index.js.flow +40 -14
  38. package/isRelayEnvironment.js.flow +1 -1
  39. package/jest-react/internalAct.js.flow +1 -1
  40. package/legacy.d.ts +143 -0
  41. package/legacy.js +1 -1
  42. package/legacy.js.flow +32 -13
  43. package/lib/ReactRelayFragmentContainer.js +1 -1
  44. package/lib/ReactRelayPaginationContainer.js +8 -8
  45. package/lib/ReactRelayRefetchContainer.js +8 -8
  46. package/lib/ReactRelayTestMocker.js +5 -5
  47. package/lib/hooks.js +18 -8
  48. package/lib/index.js +30 -14
  49. package/lib/legacy.js +26 -13
  50. package/lib/relay-hooks/legacy/useBlockingPaginationFragment.js +5 -5
  51. package/lib/relay-hooks/legacy/useRefetchableFragmentNode.js +34 -34
  52. package/lib/relay-hooks/loadEntryPoint.js +2 -2
  53. package/lib/relay-hooks/loadQuery.js +14 -14
  54. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +10 -10
  55. package/lib/relay-hooks/readFragmentInternal.js +6 -6
  56. package/lib/relay-hooks/rsc/serverFetchQuery.js +20 -0
  57. package/lib/relay-hooks/rsc/serverPreloadQuery.js +31 -0
  58. package/lib/relay-hooks/rsc/serverReadFragment.js +15 -0
  59. package/lib/relay-hooks/rsc/useQueryFromServer.js +62 -0
  60. package/lib/relay-hooks/useFragmentInternal_CURRENT.js +49 -25
  61. package/lib/relay-hooks/useFragmentInternal_EXPERIMENTAL.js +81 -44
  62. package/lib/relay-hooks/useLazyLoadQueryNode.js +32 -19
  63. package/lib/relay-hooks/useMutation.js +6 -14
  64. package/lib/relay-hooks/useMutationAction_EXPERIMENTAL.js +26 -0
  65. package/lib/relay-hooks/usePreloadedQuery.js +52 -47
  66. package/lib/relay-hooks/useQueryLoader.js +2 -2
  67. package/lib/relay-hooks/useQueryLoader_EXPERIMENTAL.js +2 -2
  68. package/lib/relay-hooks/useRefetchableFragmentInternal.js +31 -31
  69. package/lib/rsc-client_EXPERIMENTAL.js +7 -0
  70. package/lib/rsc_EXPERIMENTAL.js +43 -0
  71. package/multi-actor/ActorChange.js.flow +1 -1
  72. package/package.json +3 -2
  73. package/relay-hooks/EntryPointContainer.react.d.ts +22 -0
  74. package/relay-hooks/EntryPointContainer.react.js.flow +6 -6
  75. package/relay-hooks/EntryPointTypes.flow.js.flow +106 -108
  76. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +23 -21
  77. package/relay-hooks/MatchContainer.d.ts +95 -0
  78. package/relay-hooks/MatchContainer.js.flow +17 -11
  79. package/relay-hooks/NestedRelayEntryPointBuilderUtils.js.flow +3 -9
  80. package/relay-hooks/ProfilerContext.d.ts +18 -0
  81. package/relay-hooks/QueryResource.js.flow +9 -9
  82. package/relay-hooks/RelayEnvironmentProvider.d.ts +16 -0
  83. package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -2
  84. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +6 -6
  85. package/relay-hooks/__flowtests__/EntryPointTypes/ExtractQueryTypes-flowtest.js.flow +50 -3
  86. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +9 -9
  87. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +3 -4
  88. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +5 -6
  89. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +27 -32
  90. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +25 -25
  91. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +26 -32
  92. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +23 -30
  93. package/relay-hooks/__flowtests__/utils.js.flow +17 -17
  94. package/relay-hooks/getConnectionState.js.flow +2 -2
  95. package/relay-hooks/legacy/FragmentResource.js.flow +13 -13
  96. package/relay-hooks/legacy/useBlockingPaginationFragment.js.flow +28 -25
  97. package/relay-hooks/legacy/useFragmentNode.js.flow +4 -4
  98. package/relay-hooks/legacy/useRefetchableFragmentNode.js.flow +79 -81
  99. package/relay-hooks/loadEntryPoint.d.ts +14 -0
  100. package/relay-hooks/loadEntryPoint.js.flow +15 -13
  101. package/relay-hooks/loadQuery.d.ts +20 -0
  102. package/relay-hooks/loadQuery.js.flow +19 -19
  103. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +16 -13
  104. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +7 -7
  105. package/relay-hooks/readFragmentInternal.js.flow +11 -11
  106. package/relay-hooks/rsc/serverFetchQuery.js.flow +31 -0
  107. package/relay-hooks/rsc/serverPreloadQuery.js.flow +69 -0
  108. package/relay-hooks/rsc/serverReadFragment.js.flow +33 -0
  109. package/relay-hooks/rsc/useQueryFromServer.js.flow +135 -0
  110. package/relay-hooks/useClientQuery.d.ts +16 -0
  111. package/relay-hooks/useClientQuery.js.flow +2 -2
  112. package/relay-hooks/useEntryPointLoader.d.ts +21 -0
  113. package/relay-hooks/useEntryPointLoader.js.flow +11 -11
  114. package/relay-hooks/useFragment.d.ts +36 -0
  115. package/relay-hooks/useFragment.js.flow +8 -8
  116. package/relay-hooks/useFragmentInternal.js.flow +1 -1
  117. package/relay-hooks/useFragmentInternal_CURRENT.js.flow +54 -22
  118. package/relay-hooks/useFragmentInternal_EXPERIMENTAL.js.flow +95 -46
  119. package/relay-hooks/useIsOperationNodeActive.js.flow +1 -1
  120. package/relay-hooks/useIsParentQueryActive.js.flow +5 -1
  121. package/relay-hooks/useLazyLoadQuery.d.ts +19 -0
  122. package/relay-hooks/useLazyLoadQuery.js.flow +14 -7
  123. package/relay-hooks/useLazyLoadQueryNode.js.flow +67 -28
  124. package/relay-hooks/useLoadMoreFunction.d.ts +56 -0
  125. package/relay-hooks/useLoadMoreFunction.js.flow +7 -6
  126. package/relay-hooks/useLoadMoreFunction_EXPERIMENTAL.js.flow +5 -5
  127. package/relay-hooks/useMemoVariables.js.flow +1 -1
  128. package/relay-hooks/useMutation.d.ts +36 -0
  129. package/relay-hooks/useMutation.js.flow +9 -17
  130. package/relay-hooks/useMutationAction_EXPERIMENTAL.js.flow +68 -0
  131. package/relay-hooks/usePaginationFragment.d.ts +33 -0
  132. package/relay-hooks/usePaginationFragment.js.flow +19 -11
  133. package/relay-hooks/usePrefetchableForwardPaginationFragment.js.flow +23 -18
  134. package/relay-hooks/usePrefetchableForwardPaginationFragment_EXPERIMENTAL.js.flow +23 -18
  135. package/relay-hooks/usePreloadedQuery.d.ts +17 -0
  136. package/relay-hooks/usePreloadedQuery.js.flow +119 -85
  137. package/relay-hooks/useQueryLoader.d.ts +33 -0
  138. package/relay-hooks/useQueryLoader.js.flow +28 -24
  139. package/relay-hooks/useQueryLoader_EXPERIMENTAL.js.flow +10 -10
  140. package/relay-hooks/useRefetchableFragment.d.ts +23 -0
  141. package/relay-hooks/useRefetchableFragment.js.flow +20 -11
  142. package/relay-hooks/useRefetchableFragmentInternal.js.flow +77 -79
  143. package/relay-hooks/useRelayEnvironment.d.ts +10 -0
  144. package/relay-hooks/useRelayLoggingContext.js.flow +1 -1
  145. package/relay-hooks/useSubscribeToInvalidationState.d.ts +19 -0
  146. package/relay-hooks/useSubscribeToInvalidationState.js.flow +1 -1
  147. package/relay-hooks/useSubscription.d.ts +14 -0
  148. package/relay-hooks/useSubscription.js.flow +1 -1
  149. package/rsc-client_EXPERIMENTAL.d.ts +17 -0
  150. package/rsc-client_EXPERIMENTAL.js +10 -0
  151. package/rsc-client_EXPERIMENTAL.js.flow +23 -0
  152. package/rsc_EXPERIMENTAL.d.ts +48 -0
  153. package/rsc_EXPERIMENTAL.js +10 -0
  154. package/rsc_EXPERIMENTAL.js.flow +90 -0
@@ -41,9 +41,9 @@ export type QueryResource = QueryResourceImpl;
41
41
 
42
42
  type QueryResourceCache = Cache<QueryResourceCacheEntry>;
43
43
  type QueryResourceCacheEntry = {
44
- +id: number,
45
- +cacheIdentifier: string,
46
- +operationAvailability: ?OperationAvailability,
44
+ readonly id: number,
45
+ readonly cacheIdentifier: string,
46
+ readonly operationAvailability: ?OperationAvailability,
47
47
  // The number of received payloads for the operation.
48
48
  // We want to differentiate the initial graphql response for the operation
49
49
  // from the incremental responses, so later we can choose how to handle errors
@@ -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;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {ProviderProps, ReactElement, ReactNode} from 'react';
9
+ import {IEnvironment, RelayContext} from 'relay-runtime';
10
+
11
+ export interface Props {
12
+ children: ReactNode;
13
+ environment: IEnvironment;
14
+ }
15
+
16
+ export function RelayEnvironmentProvider(props: Props): ReactElement<ProviderProps<RelayContext>>;
@@ -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,12 +15,14 @@ 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
- +variables: {foo: string, bar: number},
22
- +response: mixed,
23
- +rawResponse?: {...},
23
+ readonly variables: {foo: string, bar: number},
24
+ readonly response: unknown,
25
+ readonly rawResponse?: {...},
24
26
  };
25
27
 
26
28
  const _good: ExtractQueryTypes<
@@ -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
  });
@@ -40,44 +40,44 @@ const usersFragment: useFragmentFlowtest_users$fragment = graphql`
40
40
  /* eslint-disable react-hooks/rules-of-hooks */
41
41
 
42
42
  // Nullability of returned data type is correct
43
- (useFragment(
43
+ useFragment(
44
44
  userFragment,
45
- (Any: useFragmentFlowtest_user$key),
46
- ): useFragmentFlowtest_user$data);
47
- (useFragment(
45
+ Any as useFragmentFlowtest_user$key,
46
+ ) as useFragmentFlowtest_user$data;
47
+ useFragment(
48
48
  userFragment,
49
- (Any: ?useFragmentFlowtest_user$key),
50
- ): ?useFragmentFlowtest_user$data);
51
- (useFragment(
49
+ Any as ?useFragmentFlowtest_user$key,
50
+ ) as ?useFragmentFlowtest_user$data;
51
+ useFragment(
52
52
  usersFragment,
53
- (Any: useFragmentFlowtest_users$key),
54
- ): useFragmentFlowtest_users$data);
55
- (useFragment(
53
+ Any as useFragmentFlowtest_users$key,
54
+ ) as useFragmentFlowtest_users$data;
55
+ useFragment(
56
56
  usersFragment,
57
- (Any: ?useFragmentFlowtest_users$key),
58
- ): ?useFragmentFlowtest_users$data);
57
+ Any as ?useFragmentFlowtest_users$key,
58
+ ) as ?useFragmentFlowtest_users$data;
59
59
 
60
- // $FlowExpectedError: can't cast nullable to non-nullable
61
- (useFragment(
60
+ // $FlowExpectedError[incompatible-type] : can't cast nullable to non-nullable
61
+ useFragment(
62
62
  userFragment,
63
- (Any: ?useFragmentFlowtest_user$key),
64
- ): useFragmentFlowtest_user$data);
65
- // $FlowExpectedError: can't cast nullable plural to non-nullable plural
66
- (useFragment(
63
+ Any as ?useFragmentFlowtest_user$key,
64
+ ) as useFragmentFlowtest_user$data;
65
+ // $FlowExpectedError[incompatible-type] : can't cast nullable plural to non-nullable plural
66
+ useFragment(
67
67
  usersFragment,
68
- (Any: ?useFragmentFlowtest_users$key),
69
- ): useFragmentFlowtest_users$data);
68
+ Any as ?useFragmentFlowtest_users$key,
69
+ ) as useFragmentFlowtest_users$data;
70
70
 
71
- // $FlowExpectedError: Key should be one of the generated types
71
+ // $FlowExpectedError[incompatible-type] : Key should be one of the generated types
72
72
  useFragment(userFragment, 'INVALID_KEY');
73
73
 
74
- // $FlowExpectedError: Key should not be a user provided object
74
+ // $FlowExpectedError[incompatible-type] : Key should not be a user provided object
75
75
  useFragment(userFragment, {a: 123});
76
76
 
77
- // $FlowExpectedError: Key should not be an empty object
77
+ // $FlowExpectedError[incompatible-type] : Key should not be an empty object
78
78
  useFragment(userFragment, {});
79
79
 
80
- // $FlowExpectedError: Key should be the `<name>$key` type from generated flow
81
- useFragment(userFragment, (Any: useFragmentFlowtest_user$data));
80
+ // $FlowExpectedError[incompatible-type] : Key should be the `<name>$key` type from generated flow
81
+ useFragment(userFragment, Any as useFragmentFlowtest_user$data);
82
82
 
83
83
  /* eslint-enable react-hooks/rules-of-hooks */
@@ -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,
@@ -48,60 +48,54 @@ type ExpectedReturnType<
48
48
 
49
49
  // Nullability of returned data type is correct
50
50
  // $FlowFixMe[prop-missing]
51
- // $FlowFixMe[incompatible-cast]
51
+ // $FlowFixMe[incompatible-type]
52
52
  // $FlowFixMe[incompatible-exact]
53
53
  // $FlowFixMe[react-rule-hook]
54
- (usePaginationFragment(
54
+ usePaginationFragment(
55
55
  refetchableFragmentInput,
56
56
  keyNonNullable,
57
- ): ExpectedReturnType<QueryVariablesSubset, QueryVariables, NonNullableData>);
57
+ ) as ExpectedReturnType<QueryVariablesSubset, QueryVariables, NonNullableData>;
58
58
 
59
59
  // $FlowFixMe[react-rule-hook]
60
- (usePaginationFragment(
60
+ usePaginationFragment(
61
61
  refetchableFragmentInput,
62
62
  keyNullable,
63
- ): ExpectedReturnType<QueryVariables, QueryVariables, NullableData>);
63
+ ) as ExpectedReturnType<QueryVariables, QueryVariables, NullableData>;
64
64
 
65
- // $FlowExpectedError: can't cast nullable to non-nullable
66
65
  // $FlowFixMe[react-rule-hook]
67
- // $FlowFixMe[incompatible-cast]
68
- (usePaginationFragment(
66
+ // $FlowFixMe[incompatible-type] can't cast nullable to non-nullable
67
+ usePaginationFragment(
69
68
  refetchableFragmentInput,
70
69
  keyNullable,
71
- ): ExpectedReturnType<QueryVariables, QueryVariables, NonNullableData>);
70
+ ) as ExpectedReturnType<QueryVariables, QueryVariables, NonNullableData>;
72
71
 
73
- // $FlowExpectedError: actual type of returned data is correct
74
72
  // $FlowFixMe[react-rule-hook]
75
73
  // $FlowFixMe[incompatible-exact]
76
74
  // $FlowFixMe[prop-missing]
77
- // $FlowFixMe[incompatible-cast]
78
- (usePaginationFragment(
75
+ // $FlowFixMe[incompatible-type] actual type of returned data is correct
76
+ usePaginationFragment(
79
77
  refetchableFragmentInput,
80
- // $FlowFixMe[incompatible-call]
78
+ // $FlowFixMe[incompatible-type]
81
79
  keyAnotherNonNullable,
82
- ): ExpectedReturnType<QueryVariables, QueryVariablesSubset, NonNullableData>);
83
- // $FlowExpectedError
80
+ ) as ExpectedReturnType<QueryVariables, QueryVariablesSubset, NonNullableData>;
84
81
  // $FlowFixMe[react-rule-hook]
85
- // $FlowFixMe[incompatible-cast]
86
- (usePaginationFragment(
82
+ // $FlowFixMe[incompatible-type]
83
+ usePaginationFragment(
87
84
  refetchableFragmentInput,
88
- // $FlowFixMe[incompatible-call]
85
+ // $FlowFixMe[incompatible-type]
89
86
  keyAnotherNullable,
90
- ): ExpectedReturnType<QueryVariables, QueryVariables, NonNullableData>);
87
+ ) as ExpectedReturnType<QueryVariables, QueryVariables, NonNullableData>;
91
88
 
92
- // $FlowExpectedError: Key should not be a user provided object
93
89
  // $FlowFixMe[react-rule-hook]
94
- // $FlowFixMe[prop-missing]
90
+ // $FlowFixMe[incompatible-type] Key should not be a user provided object
95
91
  usePaginationFragment(refetchableFragmentInput, {abc: 123});
96
92
 
97
- // $FlowExpectedError: Key should not be an empty object
98
93
  // $FlowFixMe[react-rule-hook]
99
- // $FlowFixMe[prop-missing]
94
+ // $FlowFixMe[incompatible-type] Key should not be an empty object
100
95
  usePaginationFragment(refetchableFragmentInput, {});
101
96
 
102
- // $FlowExpectedError: Key should be the `<name>$key` type from generated flow
103
97
  // $FlowFixMe[react-rule-hook]
104
- // $FlowFixMe[prop-missing]
98
+ // $FlowFixMe[incompatible-type] Key should be the `<name>$key` type from generated flow
105
99
  usePaginationFragment(refetchableFragmentInput, fragmentData);
106
100
 
107
101
  // Refetch function options:
@@ -113,12 +107,12 @@ const {refetch} = usePaginationFragment(
113
107
  refetchableFragmentInput,
114
108
  keyNonNullable,
115
109
  );
116
- // $FlowExpectedError: internal option
110
+ // $FlowExpectedError[incompatible-type] : internal option
117
111
  refetch(variables, {
118
112
  __environment: environment,
119
113
  });
120
114
 
121
- // $FlowExpectedError: doesn't exist
115
+ // $FlowExpectedError[incompatible-type] : doesn't exist
122
116
  refetch(variables, {
123
117
  NON_EXIST: 'NON_EXIST',
124
118
  });
@@ -135,17 +129,17 @@ const {loadNext} = usePaginationFragment(
135
129
  // Accepts extraVariables
136
130
  loadNext(10, {
137
131
  // $FlowFixMe[prop-missing]
138
- // $FlowFixMe[incompatible-call]
132
+ // $FlowFixMe[incompatible-type]
139
133
  UNSTABLE_extraVariables: extraVariables,
140
134
  });
141
135
 
142
136
  // $FlowFixMe[prop-missing]
143
137
  loadNext(10, {
144
- // $FlowExpectedError: doesn't accept variables not available in the Flow type
138
+ // $FlowExpectedError[incompatible-type] : doesn't accept variables not available in the Flow type
145
139
  UNSTABLE_extraVariables: invalidVariables,
146
140
  });
147
141
 
148
- // $FlowExpectedError: doesn't exist
142
+ // $FlowExpectedError[incompatible-type] : doesn't exist
149
143
  loadNext(10, {
150
144
  UNSTABLE_foo: invalidVariables,
151
145
  });