From 8a9e207869b57bfbceb0cd513136e4a75275c85f Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Wed, 3 Apr 2024 14:53:35 -0400 Subject: [PATCH] fix(ts-client): exact types on query and mutation (#755) --- package.json | 12 +- pnpm-lock.yaml | 282 +++++++++--------- .../toGraphQLDocumentString.test.ts.snap | 16 +- src/SelectionSet/toGraphQLDocumentString.ts | 2 +- src/client.ts | 5 +- src/lib/prelude.ts | 13 +- tests/ts/_/schema/Scalar.ts | 2 +- 7 files changed, 168 insertions(+), 164 deletions(-) diff --git a/package.json b/package.json index 80ff4ea50..a620b08df 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ }, "dependencies": { "@dprint/formatter": "^0.2.1", - "@dprint/typescript": "^0.89.3", + "@dprint/typescript": "^0.90.0", "@graphql-typed-document-node/core": "^3.2.0", "@molt/command": "^0.9.0", "dprint": "^0.45.0", @@ -93,9 +93,9 @@ "@types/body-parser": "^1.19.5", "@types/express": "^4.17.21", "@types/json-bigint": "^1.0.4", - "@types/node": "^20.11.30", - "@typescript-eslint/eslint-plugin": "^7.4.0", - "@typescript-eslint/parser": "^7.4.0", + "@types/node": "^20.12.3", + "@typescript-eslint/eslint-plugin": "^7.5.0", + "@typescript-eslint/parser": "^7.5.0", "apollo-server-express": "^3.13.0", "body-parser": "^1.20.2", "doctoc": "^2.2.1", @@ -111,10 +111,10 @@ "get-port": "^7.1.0", "graphql": "^16.8.1", "graphql-tag": "^2.12.6", - "happy-dom": "^14.3.9", + "happy-dom": "^14.3.10", "json-bigint": "^1.0.0", "tsx": "^4.7.1", - "type-fest": "^4.14.0", + "type-fest": "^4.15.0", "typescript": "^5.4.3", "vitest": "^1.4.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b142cd040..000577420 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ dependencies: specifier: ^0.2.1 version: 0.2.1 '@dprint/typescript': - specifier: ^0.89.3 - version: 0.89.3 + specifier: ^0.90.0 + version: 0.90.0 '@graphql-typed-document-node/core': specifier: ^3.2.0 version: 3.2.0(graphql@16.8.1) @@ -38,14 +38,14 @@ devDependencies: specifier: ^1.0.4 version: 1.0.4 '@types/node': - specifier: ^20.11.30 - version: 20.12.2 + specifier: ^20.12.3 + version: 20.12.3 '@typescript-eslint/eslint-plugin': - specifier: ^7.4.0 - version: 7.4.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3) + specifier: ^7.5.0 + version: 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.3) '@typescript-eslint/parser': - specifier: ^7.4.0 - version: 7.4.0(eslint@8.57.0)(typescript@5.4.3) + specifier: ^7.5.0 + version: 7.5.0(eslint@8.57.0)(typescript@5.4.3) apollo-server-express: specifier: ^3.13.0 version: 3.13.0(express@4.19.2)(graphql@16.8.1) @@ -63,7 +63,7 @@ devDependencies: version: 8.57.0 eslint-config-prisma: specifier: ^0.2.0 - version: 0.2.0(@typescript-eslint/eslint-plugin@7.4.0)(@typescript-eslint/parser@7.4.0)(eslint-plugin-deprecation@2.0.0)(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3)(eslint-plugin-simple-import-sort@12.0.0)(eslint-plugin-tsdoc@0.2.17)(eslint@8.57.0) + version: 0.2.0(@typescript-eslint/eslint-plugin@7.5.0)(@typescript-eslint/parser@7.5.0)(eslint-plugin-deprecation@2.0.0)(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3)(eslint-plugin-simple-import-sort@12.0.0)(eslint-plugin-tsdoc@0.2.17)(eslint@8.57.0) eslint-plugin-deprecation: specifier: ^2.0.0 version: 2.0.0(eslint@8.57.0)(typescript@5.4.3) @@ -92,8 +92,8 @@ devDependencies: specifier: ^2.12.6 version: 2.12.6(graphql@16.8.1) happy-dom: - specifier: ^14.3.9 - version: 14.3.9 + specifier: ^14.3.10 + version: 14.3.10 json-bigint: specifier: ^1.0.0 version: 1.0.0 @@ -101,14 +101,14 @@ devDependencies: specifier: ^4.7.1 version: 4.7.1 type-fest: - specifier: ^4.14.0 - version: 4.14.0 + specifier: ^4.15.0 + version: 4.15.0 typescript: specifier: ^5.4.3 version: 5.4.3 vitest: specifier: ^1.4.0 - version: 1.4.0(@types/node@20.12.2)(happy-dom@14.3.9) + version: 1.4.0(@types/node@20.12.3)(happy-dom@14.3.10) packages: @@ -301,8 +301,8 @@ packages: dev: false optional: true - /@dprint/typescript@0.89.3: - resolution: {integrity: sha512-/m6Ila0+5dKJfy2tF/ADmHrtUscYffpI/zfSUyj5DIpil8JEg6cfBERe5NUd73GrIYHuDnuC3Plg0dj52Z5sRw==} + /@dprint/typescript@0.90.0: + resolution: {integrity: sha512-8+iMqWEk0qKwSEj8qQCLoJHt29WY9q+EOG4rmemnVZtJmiqJyKliryegiIJ4xspThG05WZRLWwckVNorLWjEJA==} dev: false /@dprint/win32-x64@0.45.0: @@ -850,7 +850,7 @@ packages: resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} dependencies: - '@humanwhocodes/object-schema': 2.0.2 + '@humanwhocodes/object-schema': 2.0.3 debug: 4.3.4 minimatch: 3.1.2 transitivePeerDependencies: @@ -862,8 +862,8 @@ packages: engines: {node: '>=12.22'} dev: true - /@humanwhocodes/object-schema@2.0.2: - resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} + /@humanwhocodes/object-schema@2.0.3: + resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} dev: true /@jest/schemas@29.6.3: @@ -918,7 +918,7 @@ packages: string-length: 6.0.0 strip-ansi: 7.1.0 ts-toolbelt: 9.6.0 - type-fest: 4.14.0 + type-fest: 4.15.0 zod: 3.22.4 dev: false @@ -1254,120 +1254,120 @@ packages: resolution: {integrity: sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==} dev: true - /@rollup/rollup-android-arm-eabi@4.13.2: - resolution: {integrity: sha512-3XFIDKWMFZrMnao1mJhnOT1h2g0169Os848NhhmGweEcfJ4rCi+3yMCOLG4zA61rbJdkcrM/DjVZm9Hg5p5w7g==} + /@rollup/rollup-android-arm-eabi@4.14.0: + resolution: {integrity: sha512-jwXtxYbRt1V+CdQSy6Z+uZti7JF5irRKF8hlKfEnF/xJpcNGuuiZMBvuoYM+x9sr9iWGnzrlM0+9hvQ1kgkf1w==} cpu: [arm] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-android-arm64@4.13.2: - resolution: {integrity: sha512-GdxxXbAuM7Y/YQM9/TwwP+L0omeE/lJAR1J+olu36c3LqqZEBdsIWeQ91KBe6nxwOnb06Xh7JS2U5ooWU5/LgQ==} + /@rollup/rollup-android-arm64@4.14.0: + resolution: {integrity: sha512-fI9nduZhCccjzlsA/OuAwtFGWocxA4gqXGTLvOyiF8d+8o0fZUeSztixkYjcGq1fGZY3Tkq4yRvHPFxU+jdZ9Q==} cpu: [arm64] os: [android] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-arm64@4.13.2: - resolution: {integrity: sha512-mCMlpzlBgOTdaFs83I4XRr8wNPveJiJX1RLfv4hggyIVhfB5mJfN4P8Z6yKh+oE4Luz+qq1P3kVdWrCKcMYrrA==} + /@rollup/rollup-darwin-arm64@4.14.0: + resolution: {integrity: sha512-BcnSPRM76/cD2gQC+rQNGBN6GStBs2pl/FpweW8JYuz5J/IEa0Fr4AtrPv766DB/6b2MZ/AfSIOSGw3nEIP8SA==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-darwin-x64@4.13.2: - resolution: {integrity: sha512-yUoEvnH0FBef/NbB1u6d3HNGyruAKnN74LrPAfDQL3O32e3k3OSfLrPgSJmgb3PJrBZWfPyt6m4ZhAFa2nZp2A==} + /@rollup/rollup-darwin-x64@4.14.0: + resolution: {integrity: sha512-LDyFB9GRolGN7XI6955aFeI3wCdCUszFWumWU0deHA8VpR3nWRrjG6GtGjBrQxQKFevnUTHKCfPR4IvrW3kCgQ==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm-gnueabihf@4.13.2: - resolution: {integrity: sha512-GYbLs5ErswU/Xs7aGXqzc3RrdEjKdmoCrgzhJWyFL0r5fL3qd1NPcDKDowDnmcoSiGJeU68/Vy+OMUluRxPiLQ==} + /@rollup/rollup-linux-arm-gnueabihf@4.14.0: + resolution: {integrity: sha512-ygrGVhQP47mRh0AAD0zl6QqCbNsf0eTo+vgwkY6LunBcg0f2Jv365GXlDUECIyoXp1kKwL5WW6rsO429DBY/bA==} cpu: [arm] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-gnu@4.13.2: - resolution: {integrity: sha512-L1+D8/wqGnKQIlh4Zre9i4R4b4noxzH5DDciyahX4oOz62CphY7WDWqJoQ66zNR4oScLNOqQJfNSIAe/6TPUmQ==} + /@rollup/rollup-linux-arm64-gnu@4.14.0: + resolution: {integrity: sha512-x+uJ6MAYRlHGe9wi4HQjxpaKHPM3d3JjqqCkeC5gpnnI6OWovLdXTpfa8trjxPLnWKyBsSi5kne+146GAxFt4A==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-arm64-musl@4.13.2: - resolution: {integrity: sha512-tK5eoKFkXdz6vjfkSTCupUzCo40xueTOiOO6PeEIadlNBkadH1wNOH8ILCPIl8by/Gmb5AGAeQOFeLev7iZDOA==} + /@rollup/rollup-linux-arm64-musl@4.14.0: + resolution: {integrity: sha512-nrRw8ZTQKg6+Lttwqo6a2VxR9tOroa2m91XbdQ2sUUzHoedXlsyvY1fN4xWdqz8PKmf4orDwejxXHjh7YBGUCA==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-powerpc64le-gnu@4.13.2: - resolution: {integrity: sha512-zvXvAUGGEYi6tYhcDmb9wlOckVbuD+7z3mzInCSTACJ4DQrdSLPNUeDIcAQW39M3q6PDquqLWu7pnO39uSMRzQ==} + /@rollup/rollup-linux-powerpc64le-gnu@4.14.0: + resolution: {integrity: sha512-xV0d5jDb4aFu84XKr+lcUJ9y3qpIWhttO3Qev97z8DKLXR62LC3cXT/bMZXrjLF9X+P5oSmJTzAhqwUbY96PnA==} cpu: [ppc64le] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-riscv64-gnu@4.13.2: - resolution: {integrity: sha512-C3GSKvMtdudHCN5HdmAMSRYR2kkhgdOfye4w0xzyii7lebVr4riCgmM6lRiSCnJn2w1Xz7ZZzHKuLrjx5620kw==} + /@rollup/rollup-linux-riscv64-gnu@4.14.0: + resolution: {integrity: sha512-SDDhBQwZX6LPRoPYjAZWyL27LbcBo7WdBFWJi5PI9RPCzU8ijzkQn7tt8NXiXRiFMJCVpkuMkBf4OxSxVMizAw==} cpu: [riscv64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-s390x-gnu@4.13.2: - resolution: {integrity: sha512-l4U0KDFwzD36j7HdfJ5/TveEQ1fUTjFFQP5qIt9gBqBgu1G8/kCaq5Ok05kd5TG9F8Lltf3MoYsUMw3rNlJ0Yg==} + /@rollup/rollup-linux-s390x-gnu@4.14.0: + resolution: {integrity: sha512-RxB/qez8zIDshNJDufYlTT0ZTVut5eCpAZ3bdXDU9yTxBzui3KhbGjROK2OYTTor7alM7XBhssgoO3CZ0XD3qA==} cpu: [s390x] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-gnu@4.13.2: - resolution: {integrity: sha512-xXMLUAMzrtsvh3cZ448vbXqlUa7ZL8z0MwHp63K2IIID2+DeP5iWIT6g1SN7hg1VxPzqx0xZdiDM9l4n9LRU1A==} + /@rollup/rollup-linux-x64-gnu@4.14.0: + resolution: {integrity: sha512-C6y6z2eCNCfhZxT9u+jAM2Fup89ZjiG5pIzZIDycs1IwESviLxwkQcFRGLjnDrP+PT+v5i4YFvlcfAs+LnreXg==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-linux-x64-musl@4.13.2: - resolution: {integrity: sha512-M/JYAWickafUijWPai4ehrjzVPKRCyDb1SLuO+ZyPfoXgeCEAlgPkNXewFZx0zcnoIe3ay4UjXIMdXQXOZXWqA==} + /@rollup/rollup-linux-x64-musl@4.14.0: + resolution: {integrity: sha512-i0QwbHYfnOMYsBEyjxcwGu5SMIi9sImDVjDg087hpzXqhBSosxkE7gyIYFHgfFl4mr7RrXksIBZ4DoLoP4FhJg==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-arm64-msvc@4.13.2: - resolution: {integrity: sha512-2YWwoVg9KRkIKaXSh0mz3NmfurpmYoBBTAXA9qt7VXk0Xy12PoOP40EFuau+ajgALbbhi4uTj3tSG3tVseCjuA==} + /@rollup/rollup-win32-arm64-msvc@4.14.0: + resolution: {integrity: sha512-Fq52EYb0riNHLBTAcL0cun+rRwyZ10S9vKzhGKKgeD+XbwunszSY0rVMco5KbOsTlwovP2rTOkiII/fQ4ih/zQ==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-ia32-msvc@4.13.2: - resolution: {integrity: sha512-2FSsE9aQ6OWD20E498NYKEQLneShWes0NGMPQwxWOdws35qQXH+FplabOSP5zEe1pVjurSDOGEVCE2agFwSEsw==} + /@rollup/rollup-win32-ia32-msvc@4.14.0: + resolution: {integrity: sha512-e/PBHxPdJ00O9p5Ui43+vixSgVf4NlLsmV6QneGERJ3lnjIua/kim6PRFe3iDueT1rQcgSkYP8ZBBXa/h4iPvw==} cpu: [ia32] os: [win32] requiresBuild: true dev: true optional: true - /@rollup/rollup-win32-x64-msvc@4.13.2: - resolution: {integrity: sha512-7h7J2nokcdPePdKykd8wtc8QqqkqxIrUz7MHj6aNr8waBRU//NLDVnNjQnqQO6fqtjrtCdftpbTuOKAyrAQETQ==} + /@rollup/rollup-win32-x64-msvc@4.14.0: + resolution: {integrity: sha512-aGg7iToJjdklmxlUlJh/PaPNa4PmqHfyRMLunbL3eaMO0gp656+q1zOKkpJ/CVe9CryJv6tAN1HDoR8cNGzkag==} cpu: [x64] os: [win32] requiresBuild: true @@ -1405,27 +1405,27 @@ packages: /@types/accepts@1.3.7: resolution: {integrity: sha512-Pay9fq2lM2wXPWbteBsRAGiWH2hig4ZE2asK+mm7kUzlxRTfL961rj89I6zV/E3PcIkDqyuBEcMxFT7rccugeQ==} dependencies: - '@types/node': 20.12.2 + '@types/node': 20.12.3 dev: true /@types/body-parser@1.19.2: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.38 - '@types/node': 20.12.2 + '@types/node': 20.12.3 dev: true /@types/body-parser@1.19.5: resolution: {integrity: sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==} dependencies: '@types/connect': 3.4.38 - '@types/node': 20.12.2 + '@types/node': 20.12.3 dev: true /@types/connect@3.4.38: resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} dependencies: - '@types/node': 20.12.2 + '@types/node': 20.12.3 dev: true /@types/cors@2.8.12: @@ -1445,7 +1445,7 @@ packages: /@types/express-serve-static-core@4.17.31: resolution: {integrity: sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==} dependencies: - '@types/node': 20.12.2 + '@types/node': 20.12.3 '@types/qs': 6.9.14 '@types/range-parser': 1.2.7 dev: true @@ -1453,7 +1453,7 @@ packages: /@types/express-serve-static-core@4.17.43: resolution: {integrity: sha512-oaYtiBirUOPQGSWNGPWnzyAFJ0BP3cwvN4oWZQY+zUBwpVIGsKUkpBpSztp74drYcjavs7SKFZ4DX1V2QeN8rg==} dependencies: - '@types/node': 20.12.2 + '@types/node': 20.12.3 '@types/qs': 6.9.14 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -1465,7 +1465,7 @@ packages: '@types/body-parser': 1.19.5 '@types/express-serve-static-core': 4.17.31 '@types/qs': 6.9.14 - '@types/serve-static': 1.15.5 + '@types/serve-static': 1.15.7 dev: true /@types/express@4.17.21: @@ -1474,7 +1474,7 @@ packages: '@types/body-parser': 1.19.5 '@types/express-serve-static-core': 4.17.43 '@types/qs': 6.9.14 - '@types/serve-static': 1.15.5 + '@types/serve-static': 1.15.7 dev: true /@types/http-errors@2.0.4: @@ -1503,10 +1503,6 @@ packages: resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==} dev: true - /@types/mime@3.0.4: - resolution: {integrity: sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw==} - dev: true - /@types/ms@0.7.34: resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} dev: true @@ -1515,8 +1511,8 @@ packages: resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==} dev: true - /@types/node@20.12.2: - resolution: {integrity: sha512-zQ0NYO87hyN6Xrclcqp7f8ZbXNbRfoGWNcMvHTPQp9UUrwI0mI7XBz+cu7/W6/VClYo2g63B0cjull/srU7LgQ==} + /@types/node@20.12.3: + resolution: {integrity: sha512-sD+ia2ubTeWrOu+YMF+MTAB7E+O7qsMqAbMfW7DG3K1URwhZ5hN1pLlRVGbf4wDFzSfikL05M17EyorS86jShw==} dependencies: undici-types: 5.26.5 dev: true @@ -1528,7 +1524,7 @@ packages: /@types/parse-github-url@1.0.3: resolution: {integrity: sha512-7sTbCVmSVzK/iAsHGIxoqiyAnqix9opZm68lOvaU6DBx9EQ9kHMSp0y7Criu2OCsZ9wDllEyCRU+LU4hPRxXUA==} dependencies: - '@types/node': 20.12.2 + '@types/node': 20.12.3 dev: true /@types/qs@6.9.14: @@ -1547,23 +1543,23 @@ packages: resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==} dependencies: '@types/mime': 1.3.5 - '@types/node': 20.12.2 + '@types/node': 20.12.3 dev: true - /@types/serve-static@1.15.5: - resolution: {integrity: sha512-PDRk21MnK70hja/YF8AHfC7yIsiQHn1rcXx7ijCFBX/k+XQJhQT/gw3xekXKJvx+5SXaMMS8oqQy09Mzvz2TuQ==} + /@types/serve-static@1.15.7: + resolution: {integrity: sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==} dependencies: '@types/http-errors': 2.0.4 - '@types/mime': 3.0.4 - '@types/node': 20.12.2 + '@types/node': 20.12.3 + '@types/send': 0.17.4 dev: true /@types/unist@2.0.10: resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} dev: true - /@typescript-eslint/eslint-plugin@7.4.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3): - resolution: {integrity: sha512-yHMQ/oFaM7HZdVrVm/M2WHaNPgyuJH4WelkSVEWSSsir34kxW2kDJCxlXRhhGWEsMN0WAW/vLpKfKVcm8k+MPw==} + /@typescript-eslint/eslint-plugin@7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.3): + resolution: {integrity: sha512-HpqNTH8Du34nLxbKgVMGljZMG0rJd2O9ecvr2QLYp+7512ty1j42KnsFwspPXg1Vh8an9YImf6CokUBltisZFQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: '@typescript-eslint/parser': ^7.0.0 @@ -1574,11 +1570,11 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3) - '@typescript-eslint/scope-manager': 7.4.0 - '@typescript-eslint/type-utils': 7.4.0(eslint@8.57.0)(typescript@5.4.3) - '@typescript-eslint/utils': 7.4.0(eslint@8.57.0)(typescript@5.4.3) - '@typescript-eslint/visitor-keys': 7.4.0 + '@typescript-eslint/parser': 7.5.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/type-utils': 7.5.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4 eslint: 8.57.0 graphemer: 1.4.0 @@ -1591,8 +1587,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@7.4.0(eslint@8.57.0)(typescript@5.4.3): - resolution: {integrity: sha512-ZvKHxHLusweEUVwrGRXXUVzFgnWhigo4JurEj0dGF1tbcGh6buL+ejDdjxOQxv6ytcY1uhun1p2sm8iWStlgLQ==} + /@typescript-eslint/parser@7.5.0(eslint@8.57.0)(typescript@5.4.3): + resolution: {integrity: sha512-cj+XGhNujfD2/wzR1tabNsidnYRaFfEkcULdcIyVBYcXjBvBKOes+mpMBP7hMpOyk+gBcfXsrg4NBGAStQyxjQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1601,10 +1597,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 7.4.0 - '@typescript-eslint/types': 7.4.0 - '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.3) - '@typescript-eslint/visitor-keys': 7.4.0 + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.3) + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4 eslint: 8.57.0 typescript: 5.4.3 @@ -1620,16 +1616,16 @@ packages: '@typescript-eslint/visitor-keys': 6.21.0 dev: true - /@typescript-eslint/scope-manager@7.4.0: - resolution: {integrity: sha512-68VqENG5HK27ypafqLVs8qO+RkNc7TezCduYrx8YJpXq2QGZ30vmNZGJJJC48+MVn4G2dCV8m5ZTVnzRexTVtw==} + /@typescript-eslint/scope-manager@7.5.0: + resolution: {integrity: sha512-Z1r7uJY0MDeUlql9XJ6kRVgk/sP11sr3HKXn268HZyqL7i4cEfrdFuSSY/0tUqT37l5zT0tJOsuDP16kio85iA==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.4.0 - '@typescript-eslint/visitor-keys': 7.4.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/visitor-keys': 7.5.0 dev: true - /@typescript-eslint/type-utils@7.4.0(eslint@8.57.0)(typescript@5.4.3): - resolution: {integrity: sha512-247ETeHgr9WTRMqHbbQdzwzhuyaJ8dPTuyuUEMANqzMRB1rj/9qFIuIXK7l0FX9i9FXbHeBQl/4uz6mYuCE7Aw==} + /@typescript-eslint/type-utils@7.5.0(eslint@8.57.0)(typescript@5.4.3): + resolution: {integrity: sha512-A021Rj33+G8mx2Dqh0nMO9GyjjIBK3MqgVgZ2qlKf6CJy51wY/lkkFqq3TqqnH34XyAHUkq27IjlUkWlQRpLHw==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1638,8 +1634,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.3) - '@typescript-eslint/utils': 7.4.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.3) + '@typescript-eslint/utils': 7.5.0(eslint@8.57.0)(typescript@5.4.3) debug: 4.3.4 eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.4.3) @@ -1653,8 +1649,8 @@ packages: engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/types@7.4.0: - resolution: {integrity: sha512-mjQopsbffzJskos5B4HmbsadSJQWaRK0UxqQ7GuNA9Ga4bEKeiO6b2DnB6cM6bpc8lemaPseh0H9B/wyg+J7rw==} + /@typescript-eslint/types@7.5.0: + resolution: {integrity: sha512-tv5B4IHeAdhR7uS4+bf8Ov3k793VEVHd45viRRkehIUZxm0WF82VPiLgHzA/Xl4TGPg1ZD49vfxBKFPecD5/mg==} engines: {node: ^18.18.0 || >=20.0.0} dev: true @@ -1680,8 +1676,8 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree@7.4.0(typescript@5.4.3): - resolution: {integrity: sha512-A99j5AYoME/UBQ1ucEbbMEmGkN7SE0BvZFreSnTd1luq7yulcHdyGamZKizU7canpGDWGJ+Q6ZA9SyQobipePg==} + /@typescript-eslint/typescript-estree@7.5.0(typescript@5.4.3): + resolution: {integrity: sha512-YklQQfe0Rv2PZEueLTUffiQGKQneiIEKKnfIqPIOxgM9lKSZFCjT5Ad4VqRKj/U4+kQE3fa8YQpskViL7WjdPQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' @@ -1689,8 +1685,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 7.4.0 - '@typescript-eslint/visitor-keys': 7.4.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/visitor-keys': 7.5.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1721,8 +1717,8 @@ packages: - typescript dev: true - /@typescript-eslint/utils@7.4.0(eslint@8.57.0)(typescript@5.4.3): - resolution: {integrity: sha512-NQt9QLM4Tt8qrlBVY9lkMYzfYtNz8/6qwZg8pI3cMGlPnj6mOpRxxAm7BMJN9K0AiY+1BwJ5lVC650YJqYOuNg==} + /@typescript-eslint/utils@7.5.0(eslint@8.57.0)(typescript@5.4.3): + resolution: {integrity: sha512-3vZl9u0R+/FLQcpy2EHyRGNqAS/ofJ3Ji8aebilfJe+fobK8+LbIFmrHciLVDxjDoONmufDcnVSF38KwMEOjzw==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1730,9 +1726,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 - '@typescript-eslint/scope-manager': 7.4.0 - '@typescript-eslint/types': 7.4.0 - '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.3) + '@typescript-eslint/scope-manager': 7.5.0 + '@typescript-eslint/types': 7.5.0 + '@typescript-eslint/typescript-estree': 7.5.0(typescript@5.4.3) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1748,11 +1744,11 @@ packages: eslint-visitor-keys: 3.4.3 dev: true - /@typescript-eslint/visitor-keys@7.4.0: - resolution: {integrity: sha512-0zkC7YM0iX5Y41homUUeW1CHtZR01K3ybjM1l6QczoMuay0XKtrb93kv95AxUGwdjGr64nNqnOCwmEl616N8CA==} + /@typescript-eslint/visitor-keys@7.5.0: + resolution: {integrity: sha512-mcuHM/QircmA6O7fy6nn2w/3ditQkj+SgtOc8DW3uQ10Yfj42amm2i+6F2K4YAOPNNTmE6iM1ynM6lrSwdendA==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/types': 7.5.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1839,7 +1835,7 @@ packages: resolution: {integrity: sha512-kiV9nTt+XIauAXsowVygDxMZLplZxDWt0W8plE/nB32/V2ziM/P/TxDbSVK7FYIUt2Xo16h3/htDh199LNPCKQ==} dependencies: lodash.ismatch: 4.4.0 - remeda: 1.56.0 + remeda: 1.57.0 ts-toolbelt: 9.6.0 zod: 3.22.4 dev: false @@ -2592,7 +2588,7 @@ packages: eslint: 8.57.0 dev: true - /eslint-config-prisma@0.2.0(@typescript-eslint/eslint-plugin@7.4.0)(@typescript-eslint/parser@7.4.0)(eslint-plugin-deprecation@2.0.0)(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3)(eslint-plugin-simple-import-sort@12.0.0)(eslint-plugin-tsdoc@0.2.17)(eslint@8.57.0): + /eslint-config-prisma@0.2.0(@typescript-eslint/eslint-plugin@7.5.0)(@typescript-eslint/parser@7.5.0)(eslint-plugin-deprecation@2.0.0)(eslint-plugin-only-warn@1.1.0)(eslint-plugin-prefer-arrow@1.2.3)(eslint-plugin-simple-import-sort@12.0.0)(eslint-plugin-tsdoc@0.2.17)(eslint@8.57.0): resolution: {integrity: sha512-ky6iBCU9jk4o/SqkUmIUwspXjTfDO/d4glQ1VHrkL/SBra+PZjzsrDVX3pdXZgDw81+NFVYEBJIL4+lBL/yMCw==} peerDependencies: '@typescript-eslint/eslint-plugin': ^6 @@ -2604,8 +2600,8 @@ packages: eslint-plugin-simple-import-sort: ^10.0 eslint-plugin-tsdoc: ^0.2 dependencies: - '@typescript-eslint/eslint-plugin': 7.4.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.3) - '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/eslint-plugin': 7.5.0(@typescript-eslint/parser@7.5.0)(eslint@8.57.0)(typescript@5.4.3) + '@typescript-eslint/parser': 7.5.0(eslint@8.57.0)(typescript@5.4.3) eslint: 8.57.0 eslint-config-prettier: 9.1.0(eslint@8.57.0) eslint-plugin-deprecation: 2.0.0(eslint@8.57.0)(typescript@5.4.3) @@ -3084,8 +3080,8 @@ packages: resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==} engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} - /happy-dom@14.3.9: - resolution: {integrity: sha512-0kPQchwthekcYpYN8CvCiq+/z5bqFYDLbTxZ+yDLwT8AFRVJDFadShHRxp3VAZRy7a5isOZ1j/LzsU1dtAIZMQ==} + /happy-dom@14.3.10: + resolution: {integrity: sha512-Rh5li9vA9MF9Gkg85CbFABKTa3uoSAByILRNGb92u/vswDd561gBg2p1UW1ZauvDWWwRxPcbACK5zv3BR+gHnQ==} engines: {node: '>=16.0.0'} dependencies: entities: 4.5.0 @@ -4096,8 +4092,8 @@ packages: - supports-color dev: true - /remeda@1.56.0: - resolution: {integrity: sha512-ZGebbddlHYNIc4P6o6B/LRiUIZyuFvO9/aKxKpzzFjJxb9maUmYk5E72VpvAooh5uFw0rSbfygIV3rc49NW2xg==} + /remeda@1.57.0: + resolution: {integrity: sha512-guUqXntj7WtPuT1DLmfNCeyMZ2pE5m4ffJnWkOsbVQSvPsGIhNcKeFV94LTxqggOWwaIubUd4FZKTlGIOg2wDw==} dev: false /repeat-string@1.6.1: @@ -4172,28 +4168,28 @@ packages: glob: 7.2.3 dev: true - /rollup@4.13.2: - resolution: {integrity: sha512-MIlLgsdMprDBXC+4hsPgzWUasLO9CE4zOkj/u6j+Z6j5A4zRY+CtiXAdJyPtgCsc42g658Aeh1DlrdVEJhsL2g==} + /rollup@4.14.0: + resolution: {integrity: sha512-Qe7w62TyawbDzB4yt32R0+AbIo6m1/sqO7UPzFS8Z/ksL5mrfhA0v4CavfdmFav3D+ub4QeAgsGEe84DoWe/nQ==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true dependencies: '@types/estree': 1.0.5 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.13.2 - '@rollup/rollup-android-arm64': 4.13.2 - '@rollup/rollup-darwin-arm64': 4.13.2 - '@rollup/rollup-darwin-x64': 4.13.2 - '@rollup/rollup-linux-arm-gnueabihf': 4.13.2 - '@rollup/rollup-linux-arm64-gnu': 4.13.2 - '@rollup/rollup-linux-arm64-musl': 4.13.2 - '@rollup/rollup-linux-powerpc64le-gnu': 4.13.2 - '@rollup/rollup-linux-riscv64-gnu': 4.13.2 - '@rollup/rollup-linux-s390x-gnu': 4.13.2 - '@rollup/rollup-linux-x64-gnu': 4.13.2 - '@rollup/rollup-linux-x64-musl': 4.13.2 - '@rollup/rollup-win32-arm64-msvc': 4.13.2 - '@rollup/rollup-win32-ia32-msvc': 4.13.2 - '@rollup/rollup-win32-x64-msvc': 4.13.2 + '@rollup/rollup-android-arm-eabi': 4.14.0 + '@rollup/rollup-android-arm64': 4.14.0 + '@rollup/rollup-darwin-arm64': 4.14.0 + '@rollup/rollup-darwin-x64': 4.14.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.14.0 + '@rollup/rollup-linux-arm64-gnu': 4.14.0 + '@rollup/rollup-linux-arm64-musl': 4.14.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.14.0 + '@rollup/rollup-linux-riscv64-gnu': 4.14.0 + '@rollup/rollup-linux-s390x-gnu': 4.14.0 + '@rollup/rollup-linux-x64-gnu': 4.14.0 + '@rollup/rollup-linux-x64-musl': 4.14.0 + '@rollup/rollup-win32-arm64-msvc': 4.14.0 + '@rollup/rollup-win32-ia32-msvc': 4.14.0 + '@rollup/rollup-win32-x64-msvc': 4.14.0 fsevents: 2.3.3 dev: true @@ -4547,8 +4543,8 @@ packages: engines: {node: '>=10'} dev: true - /type-fest@4.14.0: - resolution: {integrity: sha512-on5/Cw89wwqGZQu+yWO0gGMGu8VNxsaW9SB2HE8yJjllEk7IDTwnSN1dUVldYILhYPN5HzD7WAaw2cc/jBfn0Q==} + /type-fest@4.15.0: + resolution: {integrity: sha512-tB9lu0pQpX5KJq54g+oHOLumOx+pMep4RaM6liXh2PKmVRFF+/vAtUP0ZaJ0kOySfVNjF6doBWPHhBhISKdlIA==} engines: {node: '>=16'} /type-is@1.6.18: @@ -4690,7 +4686,7 @@ packages: vfile-message: 2.0.4 dev: true - /vite-node@1.4.0(@types/node@20.12.2): + /vite-node@1.4.0(@types/node@20.12.3): resolution: {integrity: sha512-VZDAseqjrHgNd4Kh8icYHWzTKSCZMhia7GyHfhtzLW33fZlG9SwsB6CEhgyVOWkJfJ2pFLrp/Gj1FSfAiqH9Lw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -4699,7 +4695,7 @@ packages: debug: 4.3.4 pathe: 1.1.2 picocolors: 1.0.0 - vite: 5.2.7(@types/node@20.12.2) + vite: 5.2.8(@types/node@20.12.3) transitivePeerDependencies: - '@types/node' - less @@ -4711,8 +4707,8 @@ packages: - terser dev: true - /vite@5.2.7(@types/node@20.12.2): - resolution: {integrity: sha512-k14PWOKLI6pMaSzAuGtT+Cf0YmIx12z9YGon39onaJNy8DLBfBJrzg9FQEmkAM5lpHBZs9wksWAsyF/HkpEwJA==} + /vite@5.2.8(@types/node@20.12.3): + resolution: {integrity: sha512-OyZR+c1CE8yeHw5V5t59aXsUPPVTHMDjEZz8MgguLL/Q7NblxhZUlTu9xSPqlsUO/y+X7dlU05jdhvyycD55DA==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -4739,15 +4735,15 @@ packages: terser: optional: true dependencies: - '@types/node': 20.12.2 + '@types/node': 20.12.3 esbuild: 0.20.2 postcss: 8.4.38 - rollup: 4.13.2 + rollup: 4.14.0 optionalDependencies: fsevents: 2.3.3 dev: true - /vitest@1.4.0(@types/node@20.12.2)(happy-dom@14.3.9): + /vitest@1.4.0(@types/node@20.12.3)(happy-dom@14.3.10): resolution: {integrity: sha512-gujzn0g7fmwf83/WzrDTnncZt2UiXP41mHuFYFrdwaLRVQ6JYQEiME2IfEjU3vcFL3VKa75XhI3lFgn+hfVsQw==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -4772,7 +4768,7 @@ packages: jsdom: optional: true dependencies: - '@types/node': 20.12.2 + '@types/node': 20.12.3 '@vitest/expect': 1.4.0 '@vitest/runner': 1.4.0 '@vitest/snapshot': 1.4.0 @@ -4782,7 +4778,7 @@ packages: chai: 4.4.1 debug: 4.3.4 execa: 8.0.1 - happy-dom: 14.3.9 + happy-dom: 14.3.10 local-pkg: 0.5.0 magic-string: 0.30.8 pathe: 1.1.2 @@ -4791,8 +4787,8 @@ packages: strip-literal: 2.1.0 tinybench: 2.6.0 tinypool: 0.8.3 - vite: 5.2.7(@types/node@20.12.2) - vite-node: 1.4.0(@types/node@20.12.2) + vite: 5.2.8(@types/node@20.12.3) + vite-node: 1.4.0(@types/node@20.12.3) why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/src/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap b/src/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap index 0ea0838af..617b33960 100644 --- a/src/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap +++ b/src/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap @@ -395,7 +395,7 @@ exports[`$stream > Query 1`] = ` } -------------- { - object @defer(if: true) { + object @stream(if: true) { id } } @@ -412,7 +412,7 @@ exports[`$stream > Query 2`] = ` } -------------- { - object @defer(if: false) { + object @stream(if: false) { id } } @@ -447,7 +447,7 @@ exports[`$stream > Query 4`] = ` } -------------- { - object @defer(if: true) { + object @stream(if: true) { id } } @@ -466,7 +466,7 @@ exports[`$stream > Query 5`] = ` } -------------- { - object @defer(if: false) { + object @stream(if: false) { id } } @@ -483,7 +483,7 @@ exports[`$stream > Query 6`] = ` } -------------- { - object @defer(if: true) { + object @stream(if: true) { id } } @@ -500,7 +500,7 @@ exports[`$stream > Query 7`] = ` } -------------- { - object @defer(if: true) { + object @stream(if: true) { id } } @@ -519,7 +519,7 @@ exports[`$stream > Query 8`] = ` } -------------- { - object @defer(if: true, label: "foobar") { + object @stream(if: true, label: "foobar") { id } } @@ -538,7 +538,7 @@ exports[`$stream > Query 9`] = ` } -------------- { - object @defer(if: true, initialCount: 5) { + object @stream(if: true, initialCount: 5) { id } } diff --git a/src/SelectionSet/toGraphQLDocumentString.ts b/src/SelectionSet/toGraphQLDocumentString.ts index efc8067e9..08ac1fce3 100644 --- a/src/SelectionSet/toGraphQLDocumentString.ts +++ b/src/SelectionSet/toGraphQLDocumentString.ts @@ -53,7 +53,7 @@ const indicatorOrSelectionSet = (ss: Indicator | SS): string => { label: typeof $stream === `boolean` ? undefined : $stream.label, initialCount: typeof $stream === `boolean` ? undefined : $stream.initialCount, } - directives += `@defer(${directiveArgs(config)})` + directives += `@stream(${directiveArgs(config)})` } if ($defer !== undefined) { diff --git a/src/client.ts b/src/client.ts index 574a9ae95..f33b6cf5d 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,4 +1,5 @@ import request from './entrypoints/main.js' +import type { Exact } from './lib/prelude.js' import type { ResultSet } from './ResultSet/__.js' import type { Schema } from './Schema/__.js' import { SelectionSet } from './SelectionSet/__.js' @@ -9,14 +10,14 @@ export type Client<$SchemaIndex extends Schema.Index> = $SchemaIndex['Root']['Query'] extends null ? unknown : { - query: <$SelectionSet extends SelectionSet.Query<$SchemaIndex>>(selectionSet: $SelectionSet) => Promise> + query: <$SelectionSet extends object>(selectionSet: Exact<$SelectionSet, SelectionSet.Query<$SchemaIndex>>) => Promise> } ) & ( $SchemaIndex['Root']['Mutation'] extends null ? unknown : { - mutation: <$SelectionSet extends SelectionSet.Mutation<$SchemaIndex>>(selectionSet: $SelectionSet) => Promise> + mutation: <$SelectionSet extends object>(selectionSet: Exact<$SelectionSet, SelectionSet.Mutation<$SchemaIndex>>) => Promise> } ) // todo diff --git a/src/lib/prelude.ts b/src/lib/prelude.ts index e62c811bd..8f8c3f935 100644 --- a/src/lib/prelude.ts +++ b/src/lib/prelude.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ export type RemoveIndex = { [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K] } @@ -88,9 +89,15 @@ export const entries = >(obj: T) => Object.entries export const values = >(obj: T): T[keyof T][] => Object.values(obj) as T[keyof T][] -export type Exact = - | (A extends unknown ? (W extends A ? { [K in keyof A]: Exact } : W) : never) - | (A extends Narrowable ? A : never) +// dprint-ignore +export type Exact<$Value, $Constraint> = + ( + $Value extends unknown ? $Constraint extends $Value ? {} extends $Value ? $Constraint : + { [K in keyof $Value]: Exact<$Value[K], $Constraint[K]> } : + $Constraint : + never + ) + | ($Value extends Narrowable ? $Value : never) export type Narrowable = string | number | bigint | boolean | [] diff --git a/tests/ts/_/schema/Scalar.ts b/tests/ts/_/schema/Scalar.ts index 4eb035a0d..b1b26553f 100644 --- a/tests/ts/_/schema/Scalar.ts +++ b/tests/ts/_/schema/Scalar.ts @@ -6,7 +6,7 @@ declare global { } } -export const Date = Scalar.scalar('Date', Scalar.nativeScalarConstructors.String) +export const Date = Scalar.scalar(`Date`, Scalar.nativeScalarConstructors.String) export type Date = typeof Date export * from '../../../../src/Schema/NamedType/Scalar/Scalar.js'