question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error TS2694: Namespace '".../node_modules/.prisma/client/index"' has no exported member 'BatchPayload'

See original GitHub issue

Bug description

When I use deleteMany, updateMany. Prisma support type named BatchPayload but it has no exported.

How to reproduce

  1. Make any model, suppose model Alarms
  2. CRUD model in @nexus/schema, t.crud.deleteManyAlarm();
  3. tsc --noEmit or tsc
  4. @nexus/schema generated types
  5. Type Error in BatchPayload: PrismaClient.BatchPayload;
  6. generated PrismaClient has
  /**
   * Batch Payload for updateMany & deleteMany
   */

  export type BatchPayload = {
    count: number
  }
  1. However, I can’t import that.

Expected behavior

import * as PrismaClient from ".prisma/client"

no error Type namespace with PrismaClient.BatchPayload

Prisma information

model Alarm {
  id                Int            @id @default(autoincrement())
  createdAt         DateTime       @default(now())
  updatedAt         DateTime       @updatedAt
  title             String
  contents          String
  important         Boolean        @default(false)
  read              Boolean
  alarmType         AlarmType      @default(ADVERTISEMENT)
  advertisementBy   Advertisement? @relation(fields: [advertisementById], references: [id])
  advertisementById Int?
  notificationBy    Notification?  @relation(fields: [notificationById], references: [id])
  notificationById  Int?
  userBy            User?          @relation(fields: [userById], references: [id])
  userById          Int?
}

Environment & setup

  • OS: Mac OS
  • Database: MySQL
  • Node.js version: 12.14.0
  • Prisma version: 2.12.1
  • @nexus/schema: 0.19.2
  • nexus-plugin-prisma: 0.25.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
MaxPiccinnocommented, Nov 12, 2021

Sorry for necro-posting, I had the same issue and this was the first thread came from google search.

I solved it as follow: import { Prisma } from '@prisma/client'

then you can reference it as Prisma.BatchPayload.

Problem solved

1reaction
eunchurnparkcommented, Nov 30, 2020

I found problem in generated type in @nexus/schema

--- src/generated/resolverTypes.ts	2020-11-30 12:32:48.000000000 +0900
+++ src/generated/resolverTypes-gen.ts	2020-11-30 12:34:45.000000000 +0900
@@ -23445,7 +23445,7 @@
     user?: NexusGenRootTypes['User'] | null; // User
   }
   Bank: PrismaClient.Bank;
-  BatchPayload: PrismaClient.BatchPayload;
+  BatchPayload: PrismaClient.Prisma.BatchPayload;
   BestBrandGroupStatBoard: PrismaClient.BestBrandGroupStatBoard;
   BestBrandStatBoard: PrismaClient.BestBrandStatBoard;
   Brand: PrismaClient.Brand;
@@ -29340,4 +29340,4 @@
      */
     required?: boolean
   }
-}
\ No newline at end of file
+}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Importing enum from @prisma/client gives the error "Module ...
ts:4:10 - error TS2305: Module '"@prisma/client"' has no exported member 'Modality'. I'm able to import PrismaClient and use it just fine in my ......
Read more >
Generating the client (Concepts) - Prisma
This page explains how to generate Prisma Client. It also provides additional context on the generated client, typical workflows and Node.js configuration.
Read more >
解决方法:重新安装@prisma/client - CSDN博客
node_modules /.prisma/client/index.d.ts:6:3 - error TS2305: Module '"./runtime"' has no exported member 'PrismaClientUnknownRequestError'.
Read more >
jsbrain-prisma-nestjs-graphql - npm
Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module. Latest version: 0.0.0-dev.13, ...
Read more >
Prisma - Best of JS
Prisma Client can be used in any Node.js or TypeScript backend application (including ... which is exported by node_modules/@prisma/client/index.d.ts .
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