MichalLytek / MichalLytek/typegraphql-prisma

_count resolver breaks when moving from Prisma 4 to Prisma 5

Open
#428 1 comment 1 reaction 0 assignees View on GitHub
bug community
Dominant language
TypeScript
Stars
918
Forks
130
PR merge metrics
No merged PRs in 30d

Description

**Describe the Bug**
I've upgraded Prisma version from 4.x to 5.x. The typescript check for `_count` resolver now fails with missing methods. There are required methods being generated for all the `ModelCount` classes.

**Expected Behavior**
Methods in the `ModelCount` class should be optional, so that the return type of the `_count` resolver does not have to have methods in it.

**Logs**
...` is missing the following properties from type 'UserCount': getPosts,`...

**Environment (please complete the following information):**

- OS: **macOS Ventura**
- Node **19**
- `typegraphql-prisma` version **0.27.1**
- Prisma version **5.7.0**
- TypeScript version **4.8.3**

**Additional Context**
Is this a known case?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the TypeScript check with typegraphql-prisma 0.27.1, Prisma 5.7.0, and TypeScript 4.8.3, then inspect the generated ModelCount classes and _count resolver types. Done means the generated count methods are optional and the reported missing-properties error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.