tslib
tslib copied to clipboard
2.1.0 version with node and jest mocking causes errors
When upgrading to the newest versions of tslib, typescript, and jest I received the following error in an existing project:
TypeError: Cannot redefine property: upsertThing
at Function.defineProperty (<anonymous>)
jest.spyOn(transactionDomain, 'upsertThing');
upsertThing is a function exported from it's own file, then again exported from an index file via export *.... When jest tries to spy on it, this error is thrown with version 2.1.0 of tslib. But when I downgrade to tslib 1.14.1 the error goes away.
Version Info: Node: Tried on both 12 and 14 jest: 26.6.3 ts-jest: 26.4.4 ts-node: 9.1.1 typescript: 4.1.3