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.

TS2341: Property 'fetcher' is private and only accessible within class 'PrismaClient '.

See original GitHub issue

Bug description

I have a model called Fetcher. while accessing in prisma client, an type error is shown:

TS2341: Property 'fetcher' is private and only accessible within class 'PrismaClient '.

It is because there is a private field called fetcher, and the name is the same.

GlobalReject = 'rejectOnNotFound' extends keyof T
    ? T['rejectOnNotFound']
    : false
      > {
      /**
       * @private
       */
      private fetcher;
      /**
       * @private
       */
      private readonly dmmf;
      /**
       * @private
       */
      private connectionPromise?;
      /**
       * @private
       */
      private disconnectionPromise?;
      /**
       * @private
       */
      private readonly engineConfig;
      /**
       * @private
       */
      private readonly measurePerformance;

Could prisma team add an underscore to private fields?

How to reproduce

Model Fetcher {
    id     Int   @id
   // anything
}
const prisma = new PrismaClient()
await prisma.fetcher.fetchMany({})

Expected behavior

No response

Prisma information

Environment & setup

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

Prisma Version


Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
janpiocommented, Aug 22, 2022

Right now that is the easiest solution for you of course. We will try to avoid this clash in the future, but that might take some time.

0reactions
shtse8commented, Aug 22, 2022

Right now that is the easiest solution for you of course. We will try to avoid this clash in the future, but that might take some time.

It’s good to know prisma noticed the issue. As modifying model name is a tough work, it is not worth to do it for only typing. I will wait for the change. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Property 'X' is private and only accessible within class ...
For a given component all its members (methods, properties) accessed by its template must be public in the AOT compilation scenario.
Read more >
Property 'xxx' is private and only accessible within class ...
I have a project in angular 6 with very much components and private property and private method and switch to angular 7. when...
Read more >
Property is private and only accessible within class in TS
The error "Property is private and only accessible within class" occurs when we try to access a private property outside of a class....
Read more >
Property 'Forms' is private and only accessible within class
Hello need help in ionic 4, i have a problem when building the app in --prod it throws an error that i have...
Read more >
Angular Error app.component.html error TS2341
Angular Error app component html TS2341 Property var is private and only accessible within class AppComponent src 29 firebase Data 16 ...
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