chore: generate TypeScript types from the GraphQL schema #78
+3,169
−134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
A change in
schema.graphqlthat a resolver does not follow now failstsc. Closes #74.Stacked on #77 (calculator), which is on #65 (server). The base is
72-calculate-dscore. Change the base todevwhen those are merged. It does not need the login.What's in it
@graphql-codegen/cli,typescript,typescript-resolvers) inbackend/codegen.ts.npm run codegenwritesbackend/src/generated/graphql.ts. Like the Prisma client next to it, it is not committed, so afternpm cirunnpm run db:generateandnpm run codegen(README updated).codegen.ts. The three resolver files end withsatisfies Resolvers<Context>.Element.valuetoscorein the schema makestscfail with'value' does not exist in type 'ElementResolvers'.ElementGroup.apparatuscould returnnull, although the schema says it never does. It now throws a clear error (the foreign key makes it impossible).totalCountcould beundefinedwhen the query did not ask for it.CatalogConnection.totalCountnow has its own resolver that fails clearly if it is read without being calculated (the behaviour is the same as before: it is only calculated when asked for).Element.variantsandVault.variantsare typed per kind (a variant group only holds one kind).docs/API.mdanddocs/AI_USAGE.mdupdated.Notes
npm auditreports a highbracesproblem inside@graphql-codegen/cli's dependencies. It is a build tool, not part of the running server (npm audit --omit=devis clean).Testing
tsc --noEmitand the 122 tests pass against a database (0 skipped). No behaviour changed, so no new tests; the type check is the test.🤖 Generated with Claude Code