Skip to content

Invalid client generation when use model named "Record" #5500

@oceandrama

Description

@oceandrama

Bug description

If you use model named Record in your schema.prisma, this leads to errors
For example, there is _Strict type in .prisma/client/index.d.ts file:

type _Strict<U, _U = U> = U extends unknown ? U & OptionalFlat<Record<Exclude<Keys<_U>, keyof U>, never>> : never;

You can see using type Record which should be described in typesript/lib/lib.es5.d.ts
But if you have your own Record model, its type shadowed typescript definition, and many types in .prisma/client/index.d.ts file are inferred incorrectly

How to reproduce

  1. Create a schema with User and Record models
  2. Generate prisma client
  3. Try to call prisma.user.count()

Expected behavior

Result type should be number

Environment & setup

  • OS: Windows
  • Database: PostgreSQL
  • Node.js version: 14.15.4
  • Prisma version: 2.16.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions