Repository navigation
[@types/sinon] has incorrect types for useFakeTimers function. [@types/sinon__fake-timers] should be deprecated. #75752
Unanswered
eliasdawson-addepar
asked this question in
Issues with a @types package
Replies: 2 comments
|
Thanks for the discussion about " Pinging the DT module owners: @MrBigDog2U, @nicojs, @43081j, @gjednaszewski, @johnjesse, @alecf, @SimonSchick, @lo1tuma. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
@types/sinon@v22.0.0has incorrect types for arguments to theuseFakeTimersmethod.https://github.com/sinonjs/sinon/blob/84e91a491b5d88b81e6a80e5dd3f77520577f9e8/src/sinon/util/fake-timers.js#L40 shows useFakeTimers takes a number, Date, or configuration object which is passed to
@sinonjs/fake-timerscreateClock.https://github.com/sinonjs/fake-timers/blob/466d18e2651839370e927957b967ea5eaa172806/src/fake-timers-src.js#L1757
The root cause is that it is relying on types from
@types/sinon__fake-timers, butsinon@v22.xuses version of@sinonjs/fake-timerswhich includes types, so@types/sinon__fake-timersshould be deprecated and @types/sinon updated to use types from@sinonjs/fake-timersDefinitelyTyped/types/sinon/index.d.ts
Line 1185 in f40ae61
I discovered this issue after upgrading a project to sinon and receiving type errors trying to declare config
toNotFakeand was able to resolve by patching the types locally and overriding@types/sinon__fake-timersto resolve to@sinonjs/fake-timersuseFakeTimers: number | Date | Partial<FakeTimers.Config>;All reactions