This repository has been archived by the owner on Jan 14, 2021. It is now read-only.
Log event typing breaks when adding datasources to PrismaClient
constructor
#801
Labels
bug/2-confirmed
We have confirmed that this is a bug.
kind/bug
A reported bug.
tech/typescript
Issue for tech TypeScript.
Milestone
Bug description
When creating the
PrismaClient
, you can pass a log array with an entry to emit query events. By doing so, you can later on useprisma.on('query', callback);
. Without thelog
property during initialisation, the event won't work, since the typing looks atkeyof PrismaClientOptions extends 'log'
.When I add another property to the options object (e.g.
datasources
), this typing breaks. It will throw aArgument of type '"query"' is not assignable to parameter of type 'never'.ts(2345)
error. My assumption would be thatkeyof PrismaClientOptions
no longer only extends'log'
, but now also has a key called'datasources'
.Am I doing something wrong, or should this just work?
How to reproduce
The following will work fine and as expected.
But this will break the typing of the event listener:
Expected behavior
I'd expect that adding other properties to the options object, doesn't break the typings for event listeners.
The text was updated successfully, but these errors were encountered: