diff --git a/.circleci/config.yml b/.circleci/config.yml index 4743a55f95e..65d5c98dda7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -86,6 +86,24 @@ jobs: command: npm run test --workspace=<< parameters.framework >> working_directory: integration-tests + TestPeerDepTypes: + parameters: + externalPackage: + type: string + docker: + - image: cimg/node:20.6.1 + steps: + - checkout + - attach_workspace: + at: /tmp/workspace + - run: + working_directory: integration-tests/peerdeps-tsc + command: | + npm install + npm install @apollo/client@/tmp/workspace/apollo-client.tgz + npm install << parameters.externalPackage >> + npm test + workflows: Build and Test: jobs: @@ -109,3 +127,17 @@ workflows: - vite - vite-swc # -browser-esm would need a package publish to npm/CDNs + - TestPeerDepTypes: + name: Test external types for << matrix.externalPackage >> + requires: + - BuildTarball + matrix: + parameters: + externalPackage: + - "graphql@15" + - "graphql@16" + - "graphql@^17.0.0-alpha" + - "@types/react@16.8 @types/react-dom@16.8" + - "@types/react@17 @types/react-dom@17" + - "@types/react@18 @types/react-dom@18" + - "typescript@next" diff --git a/integration-tests/peerdeps-tsc/.gitignore b/integration-tests/peerdeps-tsc/.gitignore new file mode 100644 index 00000000000..db6846cb27a --- /dev/null +++ b/integration-tests/peerdeps-tsc/.gitignore @@ -0,0 +1,5 @@ +# explicitly avoiding to check in this one +# so we run this test always with the latest version +package-lock.json +dist +node_modules diff --git a/integration-tests/peerdeps-tsc/package.json b/integration-tests/peerdeps-tsc/package.json new file mode 100644 index 00000000000..15fa22cb969 --- /dev/null +++ b/integration-tests/peerdeps-tsc/package.json @@ -0,0 +1,20 @@ +{ + "name": "peerdeps-tsc", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "tsc" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "graphql": "^16.0.0", + "graphql-ws": "^5.5.5", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", + "subscriptions-transport-ws": "^0.11.0", + "typescript": "latest" + } +} diff --git a/integration-tests/peerdeps-tsc/src/index.ts b/integration-tests/peerdeps-tsc/src/index.ts new file mode 100644 index 00000000000..a0266127931 --- /dev/null +++ b/integration-tests/peerdeps-tsc/src/index.ts @@ -0,0 +1 @@ +export * from "@apollo/client"; diff --git a/integration-tests/peerdeps-tsc/tsconfig.json b/integration-tests/peerdeps-tsc/tsconfig.json new file mode 100644 index 00000000000..1dff851d2ac --- /dev/null +++ b/integration-tests/peerdeps-tsc/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "es2016", + "module": "commonjs", + "rootDir": "./src", + "outDir": "./dist", + "declaration": true, + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": false, + "types": ["react", "react-dom"], + "lib": ["es2018", "dom"] + } +} diff --git a/package.json b/package.json index 0c1964f2b36..831ed6e9419 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "npm": "^7.20.3 || ^8.0.0 || ^9.0.0" }, "peerDependencies": { - "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0", + "graphql": "^15.0.0 || ^16.0.0", "graphql-ws": "^5.5.5", "react": "^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",