You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like withGlobal has a duplicate declaration from the automated type generation. I can't pretend to know enough about how types are generated in this library to raise a fix. See below for the compilation errors. This is the problematic part of the type definition:
❯ npm run build
> vite-typescript-starter@0.0.0 build
> tsc
node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:558:18 - error TS2300: Duplicate identifier 'withGlobal'.
558 declare function withGlobal(_global: any): FakeTimers;
~~~~~~~~~~
node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:558:18 - error TS2395: Individual declarations in merged declaration 'withGlobal' must be all exported or all local.
558 declare function withGlobal(_global: any): FakeTimers;
~~~~~~~~~~
node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:562:20 - error TS2300: Duplicate identifier 'withGlobal'.
562 export declare var withGlobal: typeof withGlobal;
~~~~~~~~~~
node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:562:20 - error TS2395: Individual declarations in merged declaration 'withGlobal' must be all exported or all local.
562 export declare var withGlobal: typeof withGlobal;
~~~~~~~~~~
node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:562:20 - error TS2502: 'withGlobal' is referenced directly or indirectly in its own type annotation.
562 export declare var withGlobal: typeof withGlobal;
~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:1185:53 - error TS2694: Namespace '"/home/projects/vitejs-vite-c63jwkxe/node_modules/@sinonjs/fake-timers/types/fake-timers-src"' has no exported member 'FakeTimerInstallOpts'.
1185 useFakeTimers: boolean | Partial<FakeTimers.FakeTimerInstallOpts>;
~~~~~~~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:1335:67 - error TS2694: Namespace '"/home/projects/vitejs-vite-c63jwkxe/node_modules/@sinonjs/fake-timers/types/fake-timers-src"' has no exported member 'FakeTimerInstallOpts'.
1335 useFakeTimers(config?: number | Date | Partial<FakeTimers.FakeTimerInstallOpts>): SinonFakeTimers;
~~~~~~~~~~~~~~~~~~~~
Found 7 errors in 2 files.
Errors Files
5 node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:558
2 node_modules/@types/sinon/index.d.ts:1185
It looks like type definitions were completely reworked in v15.3.0.
For a barebones install repro, this has broken TypeScript compilation (see below).
There are 2 issues:
FakeTimerInstallOptswas renamed toConfig, breaking the@types/sinonimport. I've already raised a PR against DefinitelyTyped to fix this downstream: [sinon] Fix@sinonjs/fake-timersconfig import DefinitelyTyped/DefinitelyTyped#74827withGlobalhas a duplicate declaration from the automated type generation. I can't pretend to know enough about how types are generated in this library to raise a fix. See below for the compilation errors. This is the problematic part of the type definition:fake-timers/types/fake-timers-src.d.ts
Lines 556 to 560 in 00db41e