diff --git a/.size-limits.json b/.size-limits.json index 54bce409ebd..c7b4947027f 100644 --- a/.size-limits.json +++ b/.size-limits.json @@ -1,4 +1,4 @@ { - "dist/apollo-client.min.cjs": 41613, + "dist/apollo-client.min.cjs": 41615, "import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 34349 } diff --git a/config/jest.config.js b/config/jest.config.js index ce297ed2af0..977c2e8e80a 100644 --- a/config/jest.config.js +++ b/config/jest.config.js @@ -63,17 +63,17 @@ const standardReact19Config = { ...defaults, displayName: "ReactDOM 19", testPathIgnorePatterns: react19TestFileIgnoreList, - moduleNameMapper: { - "^react$": "react-19", - "^react-dom$": "react-dom-19", - "^react-dom/(.*)$": "react-dom-19/$1", - }, }; const standardReact18Config = { ...defaults, displayName: "ReactDOM 18", testPathIgnorePatterns: [ignoreTSFiles], + moduleNameMapper: { + "^react$": "react-18", + "^react-dom$": "react-dom-18", + "^react-dom/(.*)$": "react-dom-18/$1", + }, }; const standardReact17Config = { @@ -83,6 +83,7 @@ const standardReact17Config = { moduleNameMapper: { "^react$": "react-17", "^react-dom$": "react-dom-17", + "^react-dom/client$": "/../config/jest/react-dom-17-client.js", "^react-dom/server$": "react-dom-17/server", "^react-dom/test-utils$": "react-dom-17/test-utils", }, diff --git a/config/jest/react-dom-17-client.js b/config/jest/react-dom-17-client.js new file mode 100644 index 00000000000..44a9ae85835 --- /dev/null +++ b/config/jest/react-dom-17-client.js @@ -0,0 +1,15 @@ +// Shim for React 17 react-dom/client entrypoint imported by React Testing +// Library + +module.exports = { + hydrateRoot: () => { + throw new Error( + "Cannot use hydrateRoot with React 17. Ensure this uses legacy root instead" + ); + }, + createRoot: () => { + throw new Error( + "Cannot use createRoot with React 17. Ensure this uses legacy root instead" + ); + }, +}; diff --git a/package-lock.json b/package-lock.json index 85b634f06f0..f568baca25f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,9 +39,9 @@ "@size-limit/esbuild-why": "11.1.4", "@size-limit/preset-small-lib": "11.1.4", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "6.4.6", - "@testing-library/react": "^16.0.1", - "@testing-library/react-render-stream": "2.0.0-alpha.1", + "@testing-library/jest-dom": "6.6.3", + "@testing-library/react": "^16.1.0", + "@testing-library/react-render-stream": "2.0.0", "@testing-library/user-event": "14.5.2", "@tsconfig/node20": "20.1.4", "@types/bytes": "3.1.4", @@ -52,8 +52,9 @@ "@types/lodash": "4.17.7", "@types/node": "20.16.1", "@types/node-fetch": "2.6.11", - "@types/react": "18.3.3", - "@types/react-dom": "18.3.0", + "@types/prop-types": "^15.7.14", + "@types/react": "19.0.0", + "@types/react-dom": "19.0.0", "@types/relay-runtime": "14.1.24", "@types/use-sync-external-store": "0.0.6", "@typescript-eslint/eslint-plugin": "7.18.0", @@ -85,12 +86,12 @@ "patch-package": "8.0.0", "pkg-pr-new": "0.0.24", "prettier": "3.1.1", - "react": "18.3.1", + "react": "19.0.0", "react-17": "npm:react@^17", - "react-19": "npm:react@19.0.0", - "react-dom": "18.3.1", + "react-18": "npm:react@^18", + "react-dom": "19.0.0", "react-dom-17": "npm:react-dom@^17", - "react-dom-19": "npm:react-dom@19.0.0", + "react-dom-18": "npm:react-dom@^18", "react-error-boundary": "4.0.13", "recast": "0.23.9", "resolve": "1.22.8", @@ -3500,14 +3501,12 @@ } }, "node_modules/@testing-library/jest-dom": { - "version": "6.4.6", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.4.6.tgz", - "integrity": "sha512-8qpnGVincVDLEcQXWaHOf6zmlbwTKc6Us6PPu4CRnPXCzo2OGBS5cwgMMOWdxDpEz1mkbvXHpEy99M5Yvt682w==", + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz", + "integrity": "sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==", "dev": true, - "license": "MIT", "dependencies": { "@adobe/css-tools": "^4.4.0", - "@babel/runtime": "^7.9.2", "aria-query": "^5.0.0", "chalk": "^3.0.0", "css.escape": "^1.5.1", @@ -3519,30 +3518,6 @@ "node": ">=14", "npm": ">=6", "yarn": ">=1" - }, - "peerDependencies": { - "@jest/globals": ">= 28", - "@types/bun": "latest", - "@types/jest": ">= 28", - "jest": ">= 28", - "vitest": ">= 0.32" - }, - "peerDependenciesMeta": { - "@jest/globals": { - "optional": true - }, - "@types/bun": { - "optional": true - }, - "@types/jest": { - "optional": true - }, - "jest": { - "optional": true - }, - "vitest": { - "optional": true - } } }, "node_modules/@testing-library/jest-dom/node_modules/ansi-styles": { @@ -3603,11 +3578,10 @@ "license": "MIT" }, "node_modules/@testing-library/react": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.0.1.tgz", - "integrity": "sha512-dSmwJVtJXmku+iocRhWOUFbrERC76TX2Mnf0ATODz8brzAZrMBbzLwQixlBSanZxR6LddK3eiwpSFZgDET1URg==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.1.0.tgz", + "integrity": "sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg==", "dev": true, - "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.5" }, @@ -3616,10 +3590,10 @@ }, "peerDependencies": { "@testing-library/dom": "^10.0.0", - "@types/react": "^18.0.0", - "@types/react-dom": "^18.0.0", - "react": "^18.0.0", - "react-dom": "^18.0.0" + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -3631,9 +3605,9 @@ } }, "node_modules/@testing-library/react-render-stream": { - "version": "2.0.0-alpha.1", - "resolved": "https://registry.npmjs.org/@testing-library/react-render-stream/-/react-render-stream-2.0.0-alpha.1.tgz", - "integrity": "sha512-nCSbToZBlE3iEqzcFEv6jkXE1mw+tKSrHbfqE11K1/a9wiBd+eMfVVEb9Zyi8Rl75BLaX8z5REqHOGUg09zwTw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@testing-library/react-render-stream/-/react-render-stream-2.0.0.tgz", + "integrity": "sha512-fXDshOVxCyao0/R/cm9A1owfmE74ONHDUa+e0Xyc42SwDhpkmewxj/foRGc3CW3T5RT8pHIkwkHgnrM4MxT6FQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3645,8 +3619,8 @@ "peerDependencies": { "@jest/globals": "*", "expect": "*", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0" + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc" } }, "node_modules/@testing-library/react-render-stream/node_modules/agent-base": { @@ -4177,26 +4151,24 @@ } }, "node_modules/@types/prop-types": { - "version": "15.7.4", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.4.tgz", - "integrity": "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ==", + "version": "15.7.14", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz", + "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==", "dev": true }, "node_modules/@types/react": { - "version": "18.3.3", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", - "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.0.0.tgz", + "integrity": "sha512-MY3oPudxvMYyesqs/kW1Bh8y9VqSmf+tzqw3ae8a9DZW68pUe3zAdHeI1jc6iAysuRdACnVknHP8AhwD4/dxtg==", "dev": true, - "license": "MIT", "dependencies": { - "@types/prop-types": "*", "csstype": "^3.0.2" } }, "node_modules/@types/react-dom": { - "version": "18.3.0", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", - "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.0.0.tgz", + "integrity": "sha512-1KfiQKsH1o00p9m5ag12axHQSb3FOU9H20UTrujVSkNhuCrRHiQWFqgEnTNK5ZNfnzZv8UWrnXVqCmCF9fgY3w==", "dev": true, "dependencies": { "@types/react": "*" @@ -11069,13 +11041,10 @@ } }, "node_modules/react": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", - "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", + "integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==", "dev": true, - "dependencies": { - "loose-envify": "^1.1.0" - }, "engines": { "node": ">=0.10.0" } @@ -11094,27 +11063,29 @@ "node": ">=0.10.0" } }, - "node_modules/react-19": { + "node_modules/react-18": { "name": "react", - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/react/-/react-19.0.0.tgz", - "integrity": "sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", - "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0.tgz", + "integrity": "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==", "dev": true, "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.2" + "scheduler": "^0.25.0" }, "peerDependencies": { - "react": "^18.3.1" + "react": "^19.0.0" } }, "node_modules/react-dom-17": { @@ -11142,24 +11113,28 @@ "object-assign": "^4.1.1" } }, - "node_modules/react-dom-19": { + "node_modules/react-dom-18": { "name": "react-dom", - "version": "19.0.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.0.0.tgz", - "integrity": "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "dev": true, "dependencies": { - "scheduler": "^0.25.0" + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" }, "peerDependencies": { - "react": "^19.0.0" + "react": "^18.3.1" } }, - "node_modules/react-dom-19/node_modules/scheduler": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", - "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", - "dev": true + "node_modules/react-dom-18/node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "dev": true, + "dependencies": { + "loose-envify": "^1.1.0" + } }, "node_modules/react-error-boundary": { "version": "4.0.13", @@ -11670,13 +11645,10 @@ } }, "node_modules/scheduler": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", - "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", - "dev": true, - "dependencies": { - "loose-envify": "^1.1.0" - } + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.25.0.tgz", + "integrity": "sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==", + "dev": true }, "node_modules/semver": { "version": "6.3.1", diff --git a/package.json b/package.json index f84c9d53476..e509e80e8c6 100644 --- a/package.json +++ b/package.json @@ -122,9 +122,9 @@ "@size-limit/esbuild-why": "11.1.4", "@size-limit/preset-small-lib": "11.1.4", "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "6.4.6", - "@testing-library/react": "^16.0.1", - "@testing-library/react-render-stream": "2.0.0-alpha.1", + "@testing-library/jest-dom": "6.6.3", + "@testing-library/react": "^16.1.0", + "@testing-library/react-render-stream": "2.0.0", "@testing-library/user-event": "14.5.2", "@tsconfig/node20": "20.1.4", "@types/bytes": "3.1.4", @@ -135,8 +135,9 @@ "@types/lodash": "4.17.7", "@types/node": "20.16.1", "@types/node-fetch": "2.6.11", - "@types/react": "18.3.3", - "@types/react-dom": "18.3.0", + "@types/prop-types": "^15.7.14", + "@types/react": "19.0.0", + "@types/react-dom": "19.0.0", "@types/relay-runtime": "14.1.24", "@types/use-sync-external-store": "0.0.6", "@typescript-eslint/eslint-plugin": "7.18.0", @@ -168,12 +169,12 @@ "patch-package": "8.0.0", "pkg-pr-new": "0.0.24", "prettier": "3.1.1", - "react": "18.3.1", + "react": "19.0.0", "react-17": "npm:react@^17", - "react-19": "npm:react@19.0.0", - "react-dom": "18.3.1", + "react-18": "npm:react@^18", + "react-dom": "19.0.0", "react-dom-17": "npm:react-dom@^17", - "react-dom-19": "npm:react-dom@19.0.0", + "react-dom-18": "npm:react-dom@^18", "react-error-boundary": "4.0.13", "recast": "0.23.9", "resolve": "1.22.8", diff --git a/patches/@testing-library+react+16.0.1.patch b/patches/@testing-library+react+16.1.0.patch similarity index 100% rename from patches/@testing-library+react+16.0.1.patch rename to patches/@testing-library+react+16.1.0.patch diff --git a/src/react/components/__tests__/client/Query.test.tsx b/src/react/components/__tests__/client/Query.test.tsx index a97807838aa..624d38f137d 100644 --- a/src/react/components/__tests__/client/Query.test.tsx +++ b/src/react/components/__tests__/client/Query.test.tsx @@ -210,7 +210,7 @@ describe("Query component", () => { ]; const Component = () => ( - + {(result: any) => { if (result.loading) { return null; diff --git a/src/react/components/__tests__/ssr/getDataFromTree.test.tsx b/src/react/components/__tests__/ssr/getDataFromTree.test.tsx index 6441008606e..326bdc6828c 100644 --- a/src/react/components/__tests__/ssr/getDataFromTree.test.tsx +++ b/src/react/components/__tests__/ssr/getDataFromTree.test.tsx @@ -3,7 +3,7 @@ import React from "react"; import gql from "graphql-tag"; import { DocumentNode } from "graphql"; -import { ApolloClient } from "../../../../core"; +import { ApolloClient, TypedDocumentNode } from "../../../../core"; import { InMemoryCache as Cache } from "../../../../cache"; import { ApolloProvider, @@ -37,7 +37,7 @@ describe("SSR", () => { }); it("should run through all of the queries (also defined via Query component) that want SSR", () => { - const query = gql` + const query: TypedDocumentNode = gql` { currentUser { firstName @@ -63,7 +63,7 @@ describe("SSR", () => { const WrappedElement = () => ( - {({ data, loading }: { data: Data; loading: boolean }) => ( + {({ data, loading }) => (
{loading || !data ? "loading" : data.currentUser!.firstName}
diff --git a/src/react/hoc/__tests__/queries/recomposeWithState.ts b/src/react/hoc/__tests__/queries/recomposeWithState.tsx similarity index 87% rename from src/react/hoc/__tests__/queries/recomposeWithState.ts rename to src/react/hoc/__tests__/queries/recomposeWithState.tsx index 2ec2ad79756..68535b077c3 100644 --- a/src/react/hoc/__tests__/queries/recomposeWithState.ts +++ b/src/react/hoc/__tests__/queries/recomposeWithState.tsx @@ -1,7 +1,7 @@ // Adapted from v0.30.0 of https://github.com/acdlite/recompose/blob/master/src/packages/recompose/withState.js // to avoid incurring an indirect dependency on ua-parser-js via fbjs. -import React, { createFactory, Component } from "react"; +import React, { Component } from "react"; const setStatic = (key: string, value: string) => (BaseComponent: React.ComponentClass) => { @@ -33,7 +33,6 @@ const wrapDisplayName = ( export const withState = (stateName: string, stateUpdaterName: string, initialState: unknown) => (BaseComponent: React.ComponentClass) => { - const factory = createFactory(BaseComponent); class WithState extends Component< Record, { stateValue: unknown } @@ -58,11 +57,15 @@ export const withState = ); render() { - return factory({ - ...this.props, - [stateName]: this.state.stateValue, - [stateUpdaterName]: this.updateStateValue, - }); + return ( + + ); } } diff --git a/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx b/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx index 0a687741f64..70daf897951 100644 --- a/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx +++ b/src/react/hoc/__tests__/ssr/getDataFromTree.test.tsx @@ -5,7 +5,7 @@ import ReactDOM from "react-dom/server"; import gql from "graphql-tag"; import { DocumentNode } from "graphql"; -import { ApolloClient } from "../../../../core"; +import { ApolloClient, TypedDocumentNode } from "../../../../core"; import { ApolloProvider } from "../../../context"; import { InMemoryCache as Cache } from "../../../../cache"; import { itAsync, mockSingleLink } from "../../../../testing"; @@ -805,7 +805,7 @@ describe("SSR", () => { }); it("shouldn't run queries (via Query component) if ssr is turned to off", () => { - const query = gql` + const query: TypedDocumentNode = gql` query user($id: ID) { currentUser(id: $id) { firstName @@ -833,7 +833,7 @@ describe("SSR", () => { const Element = (props: { id: string }) => ( - {({ data, loading }: { data: Data; loading: boolean }) => ( + {({ data, loading }) => (
{loading || !data ? "loading" : data.currentUser!.firstName}
diff --git a/src/react/hoc/mutation-hoc.tsx b/src/react/hoc/mutation-hoc.tsx index 2a0291653d1..a9dc10e673f 100644 --- a/src/react/hoc/mutation-hoc.tsx +++ b/src/react/hoc/mutation-hoc.tsx @@ -5,11 +5,7 @@ import hoistNonReactStatics from "hoist-non-react-statics"; import { parser } from "../parser/index.js"; import type { DefaultContext, OperationVariables } from "../../core/types.js"; -import type { - BaseMutationOptions, - MutationFunction, - MutationResult, -} from "../types/types.js"; +import type { BaseMutationOptions } from "../types/types.js"; import { Mutation } from "../components/index.js"; import { @@ -91,12 +87,9 @@ export function withMutation< } return ( + // @ts-expect-error - {/* @ts-expect-error */} - {( - mutate: MutationFunction, - { data, ...r }: MutationResult - ) => { + {(mutate, { data, ...r }) => { // the HOC's historically hoisted the data from the execution result // up onto the result since it was passed as a nested prop // we massage the Mutation component's shape here to replicate that diff --git a/src/react/hooks/internal/useDeepMemo.ts b/src/react/hooks/internal/useDeepMemo.ts index 916e23a746d..7faf0c6d43d 100644 --- a/src/react/hooks/internal/useDeepMemo.ts +++ b/src/react/hooks/internal/useDeepMemo.ts @@ -6,7 +6,7 @@ export function useDeepMemo( memoFn: () => TValue, deps: DependencyList ) { - const ref = React.useRef<{ deps: DependencyList; value: TValue }>(); + const ref = React.useRef<{ deps: DependencyList; value: TValue }>(void 0); if (!ref.current || !equal(ref.current.deps, deps)) { ref.current = { value: memoFn(), deps }; diff --git a/src/react/hooks/useLazyQuery.ts b/src/react/hooks/useLazyQuery.ts index 671c23b9f86..e22b13fb0d4 100644 --- a/src/react/hooks/useLazyQuery.ts +++ b/src/react/hooks/useLazyQuery.ts @@ -82,11 +82,12 @@ export function useLazyQuery< options?: LazyQueryHookOptions, NoInfer> ): LazyQueryResultTuple { const execOptionsRef = - React.useRef>>(); - const optionsRef = React.useRef>(); + React.useRef>>(void 0); + const optionsRef = + React.useRef>(void 0); const queryRef = React.useRef< DocumentNode | TypedDocumentNode - >(); + >(void 0); const merged = mergeOptions(options, execOptionsRef.current || {}); const document = merged?.query ?? query; diff --git a/src/testing/internal/rtl/renderHookAsync.tsx b/src/testing/internal/rtl/renderHookAsync.tsx index fe411124357..77b998c8a78 100644 --- a/src/testing/internal/rtl/renderHookAsync.tsx +++ b/src/testing/internal/rtl/renderHookAsync.tsx @@ -31,6 +31,7 @@ export async function renderHookAsync< ): Promise> { const { initialProps, ...renderOptions } = options; + // @ts-expect-error if (renderOptions.legacyRoot && typeof ReactDOM.render !== "function") { const error = new Error( "`legacyRoot: true` is not supported in this version of React. " +