diff --git a/packages/react-relay/multi-actor/__tests__/ActorChange-test.js b/packages/react-relay/multi-actor/__tests__/ActorChange-test.js index 55057f7a47573..07f120bffb576 100644 --- a/packages/react-relay/multi-actor/__tests__/ActorChange-test.js +++ b/packages/react-relay/multi-actor/__tests__/ActorChange-test.js @@ -131,7 +131,7 @@ type Props = $ReadOnly<{ function ActorMessage(props: Props) { const data = useFragment(fragment, props.myFragment); - const [commit] = useMutation(mutation); + const [commit] = useMutation<$FlowFixMe>(mutation); // We're calling this hook only to verify that it won't throw. // `useRelayActorEnvironment` should be able to have access to `getEnvironmentForActor` function diff --git a/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js b/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js index fa3a62b663249..b8eb0883779e2 100644 --- a/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js +++ b/packages/react-relay/relay-hooks/__tests__/FragmentResource-ClientEdges-test.js @@ -237,7 +237,7 @@ describe('FragmentResource Client Edges behavior', () => { // Use our own simulation of setTimeout due to bugs in Jest's. // We can't mock SuspenseResource's setTimeout using Jest mocks because // they aren't imported from a module, so we swizzle the global one. - const timeouts = new Map(); + const timeouts = new Map(); let nextTimeoutID = 0; const originalSetTimeout = global.setTimeout; const originalClearTimeout = global.clearTimeout; diff --git a/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js b/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js index ba9bf76ffd375..a8feae198ead0 100644 --- a/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js +++ b/packages/react-relay/relay-hooks/__tests__/QueryResource-test.js @@ -286,7 +286,7 @@ describe('QueryResource', () => { let thrown = false; let sink; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(s => { + const errorFetchObservable = Observable.create<$FlowFixMe>(s => { networkExecute(); sink = s; }); @@ -331,7 +331,7 @@ describe('QueryResource', () => { }); const networkExecute = jest.fn(); - const syncFetchObservable = Observable.create(sink => { + const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { environment.commitPayload(queryMissingData, { node: { __typename: 'User', @@ -375,7 +375,7 @@ describe('QueryResource', () => { it('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(sink => { + const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { networkExecute(); sink.error(new Error('Oops')); }); @@ -702,7 +702,7 @@ describe('QueryResource', () => { let thrown = false; let sink; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(s => { + const errorFetchObservable = Observable.create<$FlowFixMe>(s => { networkExecute(); sink = s; }); @@ -753,7 +753,7 @@ describe('QueryResource', () => { }); const networkExecute = jest.fn(); - const syncFetchObservable = Observable.create(sink => { + const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { environment.commitPayload(queryMissingData, { node: { __typename: 'User', @@ -797,7 +797,7 @@ describe('QueryResource', () => { it('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(sink => { + const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { networkExecute(); sink.error(new Error('Oops')); }); @@ -1262,7 +1262,7 @@ describe('QueryResource', () => { let thrown = false; let sink; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(s => { + const errorFetchObservable = Observable.create<$FlowFixMe>(s => { networkExecute(); sink = s; }); @@ -1306,7 +1306,7 @@ describe('QueryResource', () => { }); const networkExecute = jest.fn(); - const syncFetchObservable = Observable.create(sink => { + const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { environment.commitPayload(queryMissingData, { node: { __typename: 'User', @@ -1350,7 +1350,7 @@ describe('QueryResource', () => { it('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(sink => { + const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { networkExecute(); sink.error(new Error('Oops')); }); @@ -1500,7 +1500,7 @@ describe('QueryResource', () => { let thrown = false; let sink; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(s => { + const errorFetchObservable = Observable.create<$FlowFixMe>(s => { networkExecute(); sink = s; }); @@ -1549,7 +1549,7 @@ describe('QueryResource', () => { }); const networkExecute = jest.fn(); - const syncFetchObservable = Observable.create(sink => { + const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { environment.commitPayload(queryMissingData, { node: { __typename: 'User', @@ -1593,7 +1593,7 @@ describe('QueryResource', () => { it('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(sink => { + const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { networkExecute(); sink.error(new Error('Oops')); }); @@ -1725,7 +1725,7 @@ describe('QueryResource', () => { let thrownError = false; let sink; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(s => { + const errorFetchObservable = Observable.create<$FlowFixMe>(s => { networkExecute(); sink = s; }); @@ -1772,7 +1772,7 @@ describe('QueryResource', () => { it('should return result if network observable returns synchronously', () => { const networkExecute = jest.fn(); - const syncFetchObservable = Observable.create(sink => { + const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { const snapshot = environment.lookup(query.fragment); networkExecute(); sink.next((snapshot: $FlowFixMe)); @@ -1810,7 +1810,7 @@ describe('QueryResource', () => { it('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(sink => { + const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { networkExecute(); const error = new Error('Oops'); sink.error(error); @@ -1907,7 +1907,7 @@ describe('QueryResource', () => { let thrownError = false; let sink; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(s => { + const errorFetchObservable = Observable.create<$FlowFixMe>(s => { networkExecute(); sink = s; }); @@ -1954,7 +1954,7 @@ describe('QueryResource', () => { it('should return result if network observable returns synchronously', () => { const networkExecute = jest.fn(); - const syncFetchObservable = Observable.create(sink => { + const syncFetchObservable = Observable.create<$FlowFixMe>(sink => { const snapshot = environment.lookup(query.fragment); networkExecute(); sink.next((snapshot: $FlowFixMe)); @@ -1992,7 +1992,7 @@ describe('QueryResource', () => { it('should throw error if network request errors synchronously', () => { let thrown = false; const networkExecute = jest.fn(); - const errorFetchObservable = Observable.create(sink => { + const errorFetchObservable = Observable.create<$FlowFixMe>(sink => { networkExecute(); const error = new Error('Oops'); sink.error(error); diff --git a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js index 70de54598296c..2bc83dff6da5b 100644 --- a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-test.js @@ -85,7 +85,7 @@ describe('useBlockingPaginationFragment', () => { fragmentRef: mixed, ) { // $FlowFixMe[incompatible-call] - const {data, ...result} = useBlockingPaginationFragmentOriginal( + const {data, ...result} = useBlockingPaginationFragmentOriginal( fragmentNode, // $FlowFixMe[incompatible-call] // $FlowFixMe[prop-missing] @@ -1655,7 +1655,7 @@ describe('useBlockingPaginationFragment', () => { const useLoadMoreFunction = require('../useLoadMoreFunction'); // $FlowFixMe[prop-missing] useLoadMoreFunction.mockImplementation((...args) => - jest.requireActual('../useLoadMoreFunction')(...args), + jest.requireActual('../useLoadMoreFunction')(...args), ); const callback = jest.fn(); diff --git a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js index 988aae438aec4..6c047f031e927 100644 --- a/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useBlockingPaginationFragment-with-suspense-transition-test.js @@ -77,7 +77,7 @@ describe('useBlockingPaginationFragment with useTransition', () => { ) { const [isPendingNext, startTransition] = useTransition(); // $FlowFixMe[incompatible-call] - const {data, ...result} = useBlockingPaginationFragmentOriginal( + const {data, ...result} = useBlockingPaginationFragmentOriginal( fragmentNode, // $FlowFixMe[prop-missing] // $FlowFixMe[incompatible-call] diff --git a/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js b/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js index d96db2c4f61d3..a00fadf5af393 100644 --- a/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useEntryPointLoader-test.js @@ -73,7 +73,10 @@ beforeEach(() => { }) { renderCount = (renderCount || 0) + 1; [loadedEntryPoint, entryPointLoaderCallback, disposeEntryPoint] = - useEntryPointLoader(environmentProvider, entryPoint); + useEntryPointLoader<{...}, any, any, any, any, any, any>( + environmentProvider, + entryPoint, + ); return null; }; loadEntryPoint.mockClear(); diff --git a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js index a3730cd29d0e7..db3bcf76c09d4 100644 --- a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-react-double-effects-test.js @@ -75,7 +75,7 @@ describe.skip('useFragmentNode-react-double-effects-test', () => { let renderLogs = []; const FragmentComponent = ({user}: $TEMPORARY$object<{user: mixed}>) => { - const {data} = useFragmentNode(gqlFragment, user, 'TestComponent'); + const {data} = useFragmentNode(gqlFragment, user, 'TestComponent'); useEffect(() => { renderLogs.push(`commit: ${data.name}`); return () => { diff --git a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js index bcfa1a06f085e..6cb2e355a88b4 100644 --- a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-required-test.js @@ -43,7 +43,7 @@ function useFragmentNode( __isWithinUnmatchedTypeRefinement: boolean, }>, ) { - const result = useFragmentNodeOriginal( + const result = useFragmentNodeOriginal( fragmentNode, fragmentRef, 'TestDisplayName', diff --git a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js index db42d1155be31..3a982b9857161 100644 --- a/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useFragmentNode-test.js @@ -168,7 +168,7 @@ describe.each([ >, fragmentRef: any, ) { - const result = useFragmentNodeOriginal( + const result = useFragmentNodeOriginal( fragmentNode, fragmentRef, 'TestDisplayName', diff --git a/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js b/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js index 4b418649988f4..deef29757497f 100644 --- a/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useMutation-fast-refresh-test.js @@ -82,7 +82,9 @@ describe('useLazyLoadQueryNode', () => { ReactRefreshRuntime.injectIntoGlobalHook(global); let commit; const V1 = function (props: {}) { - const [commitFn, isMutationInFlight] = useMutation(CommentCreateMutation); + const [commitFn, isMutationInFlight] = useMutation( + CommentCreateMutation, + ); commit = commitFn; return isInFlightFn(isMutationInFlight); }; @@ -116,7 +118,9 @@ describe('useLazyLoadQueryNode', () => { // Trigger a fast fresh function V2(props: any) { - const [commitFn, isMutationInFlight] = useMutation(CommentCreateMutation); + const [commitFn, isMutationInFlight] = useMutation( + CommentCreateMutation, + ); commit = commitFn; return isInFlightFn(isMutationInFlight); } diff --git a/packages/react-relay/relay-hooks/__tests__/useMutation-test.js b/packages/react-relay/relay-hooks/__tests__/useMutation-test.js index 47e9fa12cacf1..3e6408d414f3a 100644 --- a/packages/react-relay/relay-hooks/__tests__/useMutation-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useMutation-test.js @@ -94,7 +94,7 @@ beforeEach(() => { }) { const [mutation, setMutationFn] = useState(initialMutation); setMutation = setMutationFn; - const [commitFn, isMutationInFlight] = useMutation(mutation); + const [commitFn, isMutationInFlight] = useMutation(mutation); commit = (config: any) => ReactTestRenderer.act(() => { disposable = commitFn(config); diff --git a/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js b/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js index 057ad6f1145fa..c5d53802c881e 100644 --- a/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js +++ b/packages/react-relay/relay-hooks/__tests__/usePaginationFragment-test.js @@ -133,7 +133,7 @@ describe.each([ } function usePaginationFragment(fragmentNode: any, fragmentRef: any) { - const {data, ...result} = usePaginationFragmentOriginal( + const {data, ...result} = usePaginationFragmentOriginal( fragmentNode, fragmentRef, ); diff --git a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js index a08d1406a4646..93a39360ee82c 100644 --- a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragment-test.js @@ -39,7 +39,7 @@ describe('useRefetchableFragment', () => { let Renderer; function useRefetchableFragment(fragmentNode: any, fragmentRef: any) { - const [data, refetch] = useRefetchableFragmentOriginal( + const [data, refetch] = useRefetchableFragmentOriginal( fragmentNode, // $FlowFixMe[incompatible-call] // $FlowFixMe[prop-missing] diff --git a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js index 80e96bd1efd63..d69c626b4c0c0 100644 --- a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-test.js @@ -153,7 +153,7 @@ describe.each([ } function useRefetchableFragmentNode(fragmentNode: any, fragmentRef: any) { - const result = useRefetchableFragmentNodeOriginal( + const result = useRefetchableFragmentNodeOriginal( fragmentNode, fragmentRef, 'TestDisplayName', @@ -3074,7 +3074,7 @@ describe.each([ describe('disposing', () => { const unsubscribe = jest.fn(); jest.doMock('relay-runtime', () => { - const originalRuntime = jest.requireActual('relay-runtime'); + const originalRuntime = jest.requireActual('relay-runtime'); const originalInternal = originalRuntime.__internal; return { ...originalRuntime, diff --git a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js index 9dfa49ef56476..daef55abc9a1f 100644 --- a/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js +++ b/packages/react-relay/relay-hooks/__tests__/useRefetchableFragmentNode-with-suspense-transition-test.js @@ -56,7 +56,7 @@ describe('useRefetchableFragmentNode with useTransition', () => { ) { const [isPending, startTransition] = useTransition(); const {fragmentData: data, ...result} = - useRefetchableFragmentNodeOriginal( + useRefetchableFragmentNodeOriginal( fragmentNode, fragmentRef, 'TestComponent', diff --git a/packages/react-relay/relay-hooks/loadQuery.js b/packages/react-relay/relay-hooks/loadQuery.js index 6372bba4f2a9e..647ed84f03076 100644 --- a/packages/react-relay/relay-hooks/loadQuery.js +++ b/packages/react-relay/relay-hooks/loadQuery.js @@ -120,7 +120,7 @@ function loadQuery< // of the operation, and then replay them to the Observable we // ultimately return. const executionSubject = new ReplaySubject(); - const returnedObservable = Observable.create(sink => + const returnedObservable = Observable.create(sink => executionSubject.subscribe(sink), ); diff --git a/packages/react-relay/relay-hooks/preloadQuery_DEPRECATED.js b/packages/react-relay/relay-hooks/preloadQuery_DEPRECATED.js index 83559bacdf959..66bcbad9b79d8 100644 --- a/packages/react-relay/relay-hooks/preloadQuery_DEPRECATED.js +++ b/packages/react-relay/relay-hooks/preloadQuery_DEPRECATED.js @@ -44,7 +44,7 @@ const WEAKMAP_SUPPORTED = typeof WeakMap === 'function'; const STORE_OR_NETWORK_DEFAULT: PreloadFetchPolicy = 'store-or-network'; const pendingQueriesByEnvironment = WEAKMAP_SUPPORTED - ? new WeakMap() + ? new WeakMap>() : new Map(); type PendingQueryEntry = @@ -91,7 +91,7 @@ function preloadQuery( ); const source = queryEntry.kind === 'network' - ? Observable.create(sink => { + ? Observable.create(sink => { let subscription; if (pendingQueries.get(queryEntry.cacheKey) == null) { const newQueryEntry = preloadQueryDeduped( diff --git a/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js b/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js index 0fe781ec8a9e8..29f2e7e7de91b 100644 --- a/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js +++ b/packages/react-relay/relay-hooks/react-cache/__tests__/useLazyLoadQuery_REACT_CACHE-test.js @@ -659,7 +659,7 @@ describe('useLazyLoadQuery_REACT_CACHE', () => { responseIsRejected && (shouldAwaitFetchResult || responseIsSynchronous); - const thrownPromises = new Set(); + const thrownPromises = new Set(); let numberOfRendersObserved = 0; function TestComponent({output}: {output: boolean}) { numberOfRendersObserved++; diff --git a/packages/react-relay/relay-hooks/useLazyLoadQueryNode.js b/packages/react-relay/relay-hooks/useLazyLoadQueryNode.js index c420fb0e5ee49..71f15bdb178b2 100644 --- a/packages/react-relay/relay-hooks/useLazyLoadQueryNode.js +++ b/packages/react-relay/relay-hooks/useLazyLoadQueryNode.js @@ -125,7 +125,7 @@ function useLazyLoadQueryNode({ }); const {fragmentNode, fragmentRef} = preparedQueryResult; - const {data} = useFragmentNode( + const {data} = useFragmentNode<$FlowFixMe>( fragmentNode, fragmentRef, componentDisplayName, diff --git a/packages/relay-runtime/handlers/connection/ConnectionHandler.js b/packages/relay-runtime/handlers/connection/ConnectionHandler.js index 76f6ddaba149c..64ad418f80e1d 100644 --- a/packages/relay-runtime/handlers/connection/ConnectionHandler.js +++ b/packages/relay-runtime/handlers/connection/ConnectionHandler.js @@ -149,7 +149,7 @@ function update(store: RecordSourceProxy, payload: HandleFieldPayload): void { clientPageInfo && args.after === clientPageInfo.getValue(END_CURSOR) ) { - const nodeIDs = new Set(); + const nodeIDs = new Set(); mergeEdges(prevEdges, nextEdges, nodeIDs); mergeEdges(serverEdges, nextEdges, nodeIDs); } else { @@ -168,7 +168,7 @@ function update(store: RecordSourceProxy, payload: HandleFieldPayload): void { clientPageInfo && args.before === clientPageInfo.getValue(START_CURSOR) ) { - const nodeIDs = new Set(); + const nodeIDs = new Set(); mergeEdges(serverEdges, nextEdges, nodeIDs); mergeEdges(prevEdges, nextEdges, nodeIDs); } else { diff --git a/packages/relay-runtime/mutations/__tests__/readUpdatableQuery_EXPERIMENTAL-test.js b/packages/relay-runtime/mutations/__tests__/readUpdatableQuery_EXPERIMENTAL-test.js index 224ea2322a017..d47f4019b34c8 100644 --- a/packages/relay-runtime/mutations/__tests__/readUpdatableQuery_EXPERIMENTAL-test.js +++ b/packages/relay-runtime/mutations/__tests__/readUpdatableQuery_EXPERIMENTAL-test.js @@ -290,7 +290,7 @@ describe('readUpdatableQuery', () => { ).updatableData; if (updatableData.node != null) { - const propertyDescriptor = Object.getOwnPropertyDescriptor( + const propertyDescriptor = Object.getOwnPropertyDescriptor<$FlowFixMe>( updatableData.node, 'name', ); @@ -309,7 +309,7 @@ describe('readUpdatableQuery', () => { // Because node2 is not a user, selections within an inline fragment on User do not result // in a setter being created if (updatableData.node2 != null) { - const propertyDescriptor2 = Object.getOwnPropertyDescriptor( + const propertyDescriptor2 = Object.getOwnPropertyDescriptor<$FlowFixMe>( updatableData.node2, 'name', ); diff --git a/packages/relay-runtime/query/fetchQueryInternal.js b/packages/relay-runtime/query/fetchQueryInternal.js index 1ac449242cc3e..d5332430833ae 100644 --- a/packages/relay-runtime/query/fetchQueryInternal.js +++ b/packages/relay-runtime/query/fetchQueryInternal.js @@ -36,7 +36,7 @@ type RequestCacheEntry = { const WEAKMAP_SUPPORTED = typeof WeakMap === 'function'; const requestCachesByEnvironment = WEAKMAP_SUPPORTED - ? new WeakMap() + ? new WeakMap>() : new Map(); /** diff --git a/packages/relay-runtime/store/RelayExperimentalGraphResponseTransform.js b/packages/relay-runtime/store/RelayExperimentalGraphResponseTransform.js index 9b209ca30d03d..71e7a58b3669a 100644 --- a/packages/relay-runtime/store/RelayExperimentalGraphResponseTransform.js +++ b/packages/relay-runtime/store/RelayExperimentalGraphResponseTransform.js @@ -178,7 +178,7 @@ export class GraphModeNormalizer { if (maybeSent != null) { return maybeSent; } - const sent = new Set(); + const sent = new Set(); this._sentFields.set(cacheKey, sent); return sent; } diff --git a/packages/relay-runtime/store/RelayModernStore.js b/packages/relay-runtime/store/RelayModernStore.js index 09a6578b40c32..de67c2934eb16 100644 --- a/packages/relay-runtime/store/RelayModernStore.js +++ b/packages/relay-runtime/store/RelayModernStore.js @@ -457,7 +457,7 @@ class RelayModernStore implements Store { } lookupInvalidationState(dataIDs: $ReadOnlyArray): InvalidationState { - const invalidations = new Map(); + const invalidations = new Map(); dataIDs.forEach(dataID => { const record = this.getSource().get(dataID); invalidations.set( @@ -602,7 +602,7 @@ class RelayModernStore implements Store { /* eslint-disable no-labels */ top: while (true) { const startEpoch = this._currentWriteEpoch; - const references = new Set(); + const references = new Set(); // Mark all records that are traversable from a root for (const {operation} of this._roots.values()) { diff --git a/packages/relay-runtime/store/RelayOperationTracker.js b/packages/relay-runtime/store/RelayOperationTracker.js index feb8922b36399..986cce5d1c3e2 100644 --- a/packages/relay-runtime/store/RelayOperationTracker.js +++ b/packages/relay-runtime/store/RelayOperationTracker.js @@ -10,6 +10,7 @@ */ 'use strict'; +import type {RequestIdentifier} from '../util/getRequestIdentifier'; import type {RequestDescriptor} from './RelayStoreTypes'; @@ -45,7 +46,7 @@ class RelayOperationTracker { return; } const pendingOperationIdentifier = pendingOperation.identifier; - const newlyAffectedOwnersIdentifier = new Set(); + const newlyAffectedOwnersIdentifier = new Set(); for (const owner of affectedOwners) { const ownerIdentifier = owner.identifier; const pendingOperationsAffectingOwner = @@ -105,11 +106,11 @@ class RelayOperationTracker { return; } // These were the owners affected only by `pendingOperationIdentifier` - const completedOwnersIdentifier = new Set(); + const completedOwnersIdentifier = new Set(); // These were the owners affected by `pendingOperationIdentifier` // and some other operations - const updatedOwnersIdentifier = new Set(); + const updatedOwnersIdentifier = new Set(); for (const ownerIdentifier of affectedOwnersIdentifier) { const pendingOperationsAffectingOwner = this._ownersToPendingOperations.get(ownerIdentifier); diff --git a/packages/relay-runtime/store/__tests__/ClientID-test.js b/packages/relay-runtime/store/__tests__/ClientID-test.js index 8e9cf613487c3..ff0f208263d9f 100644 --- a/packages/relay-runtime/store/__tests__/ClientID-test.js +++ b/packages/relay-runtime/store/__tests__/ClientID-test.js @@ -10,6 +10,7 @@ */ 'use strict'; +import type {DataID} from 'relay-runtime/util/RelayRuntimeTypes'; const { generateClientID, @@ -18,7 +19,7 @@ const { } = require('../ClientID'); it('creates unique local ids', () => { - const set = new Set(); + const set = new Set(); for (let i = 0; i < 10; i++) { const id = generateUniqueClientID(); expect(set.has(id)).toBe(false); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js index 6405a16ca78d3..57cd5efc4caac 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ApplyUpdate-test.js @@ -235,7 +235,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( beforeEach(() => { taskID = 0; - tasks = new Map(); + tasks = new Map void>(); scheduler = { cancel: (id: string) => { tasks.delete(id); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js index a87f047f409e5..13d7d9f36d192 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitPayload-test.js @@ -349,7 +349,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( beforeEach(() => { taskID = 0; - tasks = new Map(); + tasks = new Map void>(); scheduler = { cancel: (id: string) => { tasks.delete(id); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js index c5f85c4af38ee..0c3453742d2ad 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-CommitUpdate-test.js @@ -103,7 +103,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( beforeEach(() => { taskID = 0; - tasks = new Map(); + tasks = new Map void>(); scheduler = { cancel: (id: string) => { tasks.delete(id); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithFlight-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithFlight-test.js index 4dce613b79667..be52b22db47b8 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithFlight-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteMutationWithFlight-test.js @@ -139,7 +139,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( _variables: Variables, _cacheConfig: CacheConfig, ) => { - return RelayObservable.create(sink => { + return RelayObservable.create(sink => { subject = sink; }); }; diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js index 0d76f6a788bb2..d99ef8b74d3db 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteSubscriptionWithMatch-test.js @@ -705,7 +705,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( beforeEach(() => { taskID = 0; - tasks = new Map(); + tasks = new Map void>(); scheduler = { cancel: (id: string) => { tasks.delete(id); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithFlight-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithFlight-test.js index ac77d297eb367..6ca0917db99d7 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithFlight-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithFlight-test.js @@ -98,7 +98,7 @@ describe.each(['RelayModernEnvironment', 'MultiActorEnvironment'])( _variables: Variables, _cacheConfig: CacheConfig, ) => { - return RelayObservable.create(sink => { + return RelayObservable.create<$FlowFixMe>(sink => { dataSource = sink; }); }; diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js index 2e1dd480502d0..ec8495993873f 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStream-test.js @@ -117,7 +117,7 @@ describe('execute() a query with @stream', () => { _variables: Variables, _cacheConfig: CacheConfig, ) => { - return RelayObservable.create(sink => { + return RelayObservable.create<$FlowFixMe>(sink => { dataSource = sink; }); }; @@ -503,7 +503,7 @@ describe('execute() a query with @stream', () => { it('processes streamed payloads with scheduling', () => { let taskID = 0; - const tasks = new Map(); + const tasks = new Map void>(); const scheduler = { cancel: (id: string) => { tasks.delete(id); @@ -604,7 +604,7 @@ describe('execute() a query with @stream', () => { it('cancels processing of streamed payloads with scheduling', () => { let taskID = 0; - const tasks = new Map(); + const tasks = new Map void>(); const scheduler = { cancel: (id: string) => { tasks.delete(id); diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js index d219cf393db60..95b76caf4d449 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-ExecuteWithStreamedConnection-test.js @@ -125,7 +125,7 @@ describe('execute() fetches a @stream-ed @connection', () => { _variables: Variables, _cacheConfig: CacheConfig, ) => { - return RelayObservable.create(sink => { + return RelayObservable.create<$FlowFixMe>(sink => { dataSource = sink; }); }; diff --git a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js index 2f62a69592360..31a0935bca51f 100644 --- a/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js +++ b/packages/relay-runtime/store/__tests__/RelayModernEnvironment-isServer-test.js @@ -23,7 +23,7 @@ const {disallowWarnings} = require('relay-test-utils-internal'); disallowWarnings(); describe('isServer', () => { - const fetch = () => Observable.create(() => {}); + const fetch = () => Observable.create(() => {}); it('defaults to false', () => { const environment = new Environment({ network: Network.create(fetch), diff --git a/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js b/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js index 55e80647a4ab2..2d19a2c026078 100644 --- a/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReferenceMarker-test.js @@ -10,6 +10,7 @@ */ 'use strict'; +import type {DataID} from 'relay-runtime/util/RelayRuntimeTypes'; import RelayNetwork from '../../network/RelayNetwork'; import RelayModernEnvironment from '../RelayModernEnvironment'; @@ -126,7 +127,7 @@ describe('RelayReferenceMarker', () => { } } `; - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(FooQuery.operation, ROOT_ID, { @@ -215,7 +216,7 @@ describe('RelayReferenceMarker', () => { } } `; - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(UserProfile.operation, ROOT_ID, { @@ -320,7 +321,7 @@ describe('RelayReferenceMarker', () => { } } `; - let references = new Set(); + let references = new Set(); mark( source, createNormalizationSelector(UserProfile.operation, ROOT_ID, { @@ -443,7 +444,7 @@ describe('RelayReferenceMarker', () => { } } `; - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(FooQuery.operation, ROOT_ID, { @@ -552,7 +553,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -605,7 +606,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -650,7 +651,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -706,7 +707,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -750,7 +751,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -791,7 +792,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -823,7 +824,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -849,7 +850,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -882,7 +883,7 @@ describe('RelayReferenceMarker', () => { }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); const loader = { get: jest.fn( moduleName => nodes[String(moduleName).replace(/\$.*/, '')], @@ -931,7 +932,7 @@ describe('RelayReferenceMarker', () => { }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); const loader = { get: jest.fn( moduleName => nodes[String(moduleName).replace(/\$.*/, '')], @@ -979,7 +980,7 @@ describe('RelayReferenceMarker', () => { }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); const loader = { get: jest.fn( moduleName => nodes[String(moduleName).replace(/\$.*/, '')], @@ -1103,7 +1104,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -1153,7 +1154,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -1195,7 +1196,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -1248,7 +1249,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -1289,7 +1290,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -1327,7 +1328,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( source, createNormalizationSelector(BarQuery.operation, 'client:root', { @@ -1375,7 +1376,7 @@ describe('RelayReferenceMarker', () => { }, }; source = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); expect(() => mark( source, @@ -1435,7 +1436,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(Query.operation, 'client:root', {id: '1'}), @@ -1459,7 +1460,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(Query.operation, 'client:root', {id: '1'}), @@ -1511,7 +1512,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(Query.operation, 'client:root', {id: '1'}), @@ -1535,7 +1536,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(storeData); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(Query.operation, 'client:root', {id: '1'}), @@ -1638,7 +1639,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(data); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(FlightQuery.operation, 'client:root', { @@ -1682,7 +1683,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(data); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(FlightQuery.operation, 'client:root', { @@ -1722,7 +1723,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(data); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(FlightQuery.operation, 'client:root', { @@ -1762,7 +1763,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(data); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(FlightQuery.operation, 'client:root', { @@ -1800,7 +1801,7 @@ describe('RelayReferenceMarker', () => { }, }; const recordSource = RelayRecordSource.create(data); - const references = new Set(); + const references = new Set(); mark( recordSource, createNormalizationSelector(FlightQuery.operation, 'client:root', { diff --git a/packages/relay-runtime/store/experimental-live-resolvers/LiveResolverStore.js b/packages/relay-runtime/store/experimental-live-resolvers/LiveResolverStore.js index f58e87d00c0d5..22facf9f1df15 100644 --- a/packages/relay-runtime/store/experimental-live-resolvers/LiveResolverStore.js +++ b/packages/relay-runtime/store/experimental-live-resolvers/LiveResolverStore.js @@ -501,7 +501,7 @@ class LiveResolverStore implements Store { // real RelayModernStore can create. For now we just use any. // $FlowFixMe lookupInvalidationState(dataIDs: $ReadOnlyArray): any { - const invalidations = new Map(); + const invalidations = new Map(); dataIDs.forEach(dataID => { const record = this.getSource().get(dataID); invalidations.set( @@ -663,7 +663,7 @@ class LiveResolverStore implements Store { /* eslint-disable no-labels */ top: while (true) { const startEpoch = this._currentWriteEpoch; - const references = new Set(); + const references = new Set(); // Mark all records that are traversable from a root for (const {operation} of this._roots.values()) { diff --git a/packages/relay-runtime/util/StringInterner.js b/packages/relay-runtime/util/StringInterner.js index bb40310cd78db..b72650364b6d2 100644 --- a/packages/relay-runtime/util/StringInterner.js +++ b/packages/relay-runtime/util/StringInterner.js @@ -11,7 +11,7 @@ 'use strict'; -const internTable = new Map(); +const internTable = new Map(); let nextIndex = 1; const digits = initDigitTable(); @@ -26,7 +26,7 @@ const ESCAPE_PREFIX = '\v'; function initDigitTable() { // disable lint because digits isn't defined when this function is called // eslint-disable-next-line no-shadow - const digits = new Set(); + const digits = new Set(); for (let i = 0; i < 10; ++i) { digits.add(i.toString()); } diff --git a/packages/relay-test-utils-internal/trackRetentionForEnvironment.js b/packages/relay-test-utils-internal/trackRetentionForEnvironment.js index cd42005358fb2..6131233edc55d 100644 --- a/packages/relay-test-utils-internal/trackRetentionForEnvironment.js +++ b/packages/relay-test-utils-internal/trackRetentionForEnvironment.js @@ -26,7 +26,7 @@ function trackRetentionForEnvironment(environment: IEnvironment): { release_DEPRECATED: JestMockFn<[mixed], void>, isOperationRetained: OperationDescriptor => boolean, } { - const retainCountsByOperation = new Map(); + const retainCountsByOperation = new Map(); const release = jest.fn(id => { const existing = retainCountsByOperation.get(id) ?? NaN;