Hello :)
When using "@types/sinon": "^5.0.1" with tsc 2.6.1 I get the following error when compiling:
node_modules/@types/sinon/index.d.ts(489,36): error TS1005: ';' expected.
it refers to this code line:
type SinonStubbedMember<T> = T extends Function ? SinonStub : T;
Downgrading to sinon 4.x.x helped for the moment.
@43081j @andy-ms
Try updating your installed TypeScript version to at least 2.8.
@andy-ms having the same problem here. Forgive me if I am ignorant, but updating my typescript version broke a lot of my other dependencies. How would I go about solving that to test if this works?
What dependencies? All @types packages should be tested to work with the latest TypeScript.
I had this same issue and upgrading typescript to 3.0.1 fixed the error. Hope this helps.
I'm unable to publish a package to npm because of issues in this package:
user$ npm publish
> [email protected] prepare .
> rm -rf lib && tsc
node_modules/@types/sinon/index.d.ts:41:20 - error TS2370: A rest parameter must be of an array type.
41 calledWith(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:45:27 - error TS2370: A rest parameter must be of an array type.
45 calledWithExactly(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:56:24 - error TS2370: A rest parameter must be of an array type.
56 calledOnceWith(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:57:31 - error TS2370: A rest parameter must be of an array type.
57 calledOnceWithExactly(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:63:25 - error TS2370: A rest parameter must be of an array type.
63 calledWithMatch(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:68:23 - error TS2370: A rest parameter must be of an array type.
68 notCalledWith(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:74:28 - error TS2370: A rest parameter must be of an array type.
74 notCalledWithMatch(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:249:18 - error TS2370: A rest parameter must be of an array type.
249 withArgs(...args: TArgs): SinonSpy<TArgs, TReturnValue>;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:258:26 - error TS2370: A rest parameter must be of an array type.
258 alwaysCalledWith(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:263:33 - error TS2370: A rest parameter must be of an array type.
263 alwaysCalledWithExactly(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:269:31 - error TS2370: A rest parameter must be of an array type.
269 alwaysCalledWithMatch(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:274:25 - error TS2370: A rest parameter must be of an array type.
274 neverCalledWith(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:280:30 - error TS2370: A rest parameter must be of an array type.
280 neverCalledWithMatch(...args: TArgs): boolean;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:303:24 - error TS2370: A rest parameter must be of an array type.
303 invokeCallback(...args: TArgs): void;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:359:13 - error TS2370: A rest parameter must be of an array type.
359 ...args: infer TArgs
~~~~~~~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:361:24 - error TS2344: Type 'TArgs' does not satisfy the constraint 'any[]'.
361 ? SinonSpy<TArgs, TReturnValue>
~~~~~
node_modules/@types/sinon/index.d.ts:527:26 - error TS2370: A rest parameter must be of an array type.
527 callsFake(func: (...args: TArgs) => TReturnValue): SinonStub<TArgs, TReturnValue>;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:634:18 - error TS2370: A rest parameter must be of an array type.
634 withArgs(...args: TArgs): SinonStub<TArgs, TReturnValue>;
~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:655:13 - error TS2370: A rest parameter must be of an array type.
655 ...args: infer TArgs
~~~~~~~~~~~~~~~~~~~~
node_modules/@types/sinon/index.d.ts:657:25 - error TS2344: Type 'TArgs' does not satisfy the constraint 'any[]'.
657 ? SinonStub<TArgs, TReturnValue>
~~~~~
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @titan-suite/[email protected] prepare: `rm -rf lib && tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @titan-suite/[email protected] prepare script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2018-12-11T22_26_31_095Z-debug.log
Is there a way to resolve these? @andy-ms
@ToJen the latest version of @types/sinon needs [email protected] or higher; you could install that or install @types/[email protected] instead.
Was just about to update that it worked @andy-ms thanks
Most helpful comment
Try updating your installed TypeScript version to at least 2.8.