Type of property 'AND' circularly references itself in mapped type when using jest-mock-extended

See original GitHub issue

Bug description

  validateUpsert(args: PrismaTypes.CandidateUpsertArgs) {
    return Prisma.validator<PrismaTypes.CandidateUpsertArgs>()(args)
  }
packages/repo/src/repository/candidate.ts:22:12 - error TS2615: Type of property 'AND' circularly references itself in mapped type '{ [K in keyof CandidateCommentScalarWhereInput]: K extends keyof CandidateCommentScalarWhereInput ? Exact<CandidateCommentScalarWhereInput[K], CandidateCommentScalarWhereInput[K]> : CandidateCommentScalarWhereInput[K]; }'.

How to reproduce

Expected behavior

No response

Prisma information

Environment & setup

  • OS:
  • Database:
  • Node.js version:

Prisma Version


Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
revmischacommented, Jan 1, 2022

I have "strictNullChecks": true and the error persists for me

6reactions
AntoineGGGcommented, Jan 26, 2022

Same issue here:

image

__tests__/user.spec.ts:19:5 - error TS2615: Type of property 'AND' circularly references itself in mapped type '{ [K in keyof { AND?: Enumerable<UtilisateurScalarWhereWithAggregatesInput>; OR?: Enumerable<UtilisateurScalarWhereWithAggregatesInput>; ... 5 more ...; dateModification?: string | ... 1 more ... | DateTimeWithAggregatesFilter; }]: Or<...> extends 1 ? { ...; }[K] extends infer TK ? GetHavingFields<...> : never : {} ...'.

19     prismaMock.utilisateur.create.mockResolvedValue(user),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__tests__/user.spec.ts:19:5 - error TS2615: Type of property 'NOT' circularly references itself in mapped type '{ [K in keyof { AND?: Enumerable<UtilisateurScalarWhereWithAggregatesInput>; OR?: Enumerable<UtilisateurScalarWhereWithAggregatesInput>; ... 5 more ...; dateModification?: string | ... 1 more ... | DateTimeWithAggregatesFilter; }]: Or<...> extends 1 ? { ...; }[K] extends infer TK ? GetHavingFields<...> : never : {} ...'.

19     prismaMock.utilisateur.create.mockResolvedValue(user),
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__tests__/user.spec.ts:19:5 - error TS2615: Type of property 'OR' circularly references itself in mapped type '{ [K in keyof { AND?: Enumerable<UtilisateurScalarWhereWithAggregatesInput>; OR?: Enumerable<UtilisateurScalarWhereWithAggregatesInput>; ... 5 more ...; dateModification?: string | ... 1 more ... | DateTimeWithAggregatesFilter; }]: Or<...> extends 1 ? { ...; }[K] extends infer TK ? GetHavingFields<...> : never : {} ...'.

19     prismaMock.utilisateur.create.mockResolvedValue(user),`
Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript circular reference when testing prisma with jest ...
Type of property 'AND' circularly references itself in mapped type. There is some discussion about this issue on github Testing with prisma.
Read more >
System requirements - Prisma
$server.ts:6:25 - error TS2615: Type of property 'OR' circularly references itself in mapped type '{ [K in keyof { AND?:
Read more >
jest-mock-extended - npm
jest -mock-extended allows for invocation matching expectations. Types of arguments, even when using matchers are type checked. const provider = ...
Read more >
TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >
Mock Functions - Jest
You can create a mock function with jest.fn(). ... Reference. mockFn. ... Each entry in this array is an object containing a type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found