Closed micalevisk closed 3 years ago
Hi @micalevisk Hmm 🤔 I'm not super good at TypeScript and the types are managed over in https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest-when. I've actually not been involved with those at all. I think you'd need to log an issue over there. Perhaps one day we can rewrite this lib in TS, but it won't be soon.
Hey!
While using this lib with TypeORM, I'm facing this limitation for function overloading.
Let's say I want to mock a call for
repository.findOne
method which have 3 overloads. I'll get this:since jest-when only recognize the last overload of
.findOne
which isfindOne(conditions?: FindConditions<Entity>, options?: FindOneOptions<Entity>)
and I'm using the first one (which isfindOne(id?: string|number|Date|ObjectID, options?: FindOneOptions<Entity>)
) :confused:Is there any know workaround for this? Meanwhile I'm using
//@ts-expect-error
Great lib btw!