TS2341: Property 'fetcher' is private and only accessible within class 'PrismaClient '.
See original GitHub issueBug 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:
- Created a year ago
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!