Definitelytyped: [@types/sinon] version 5.0.6: error TS2370: A rest parameter must be of an array type.

Created on 19 Nov 2018  路  13Comments  路  Source: DefinitelyTyped/DefinitelyTyped

If you know how to fix the issue, make a pull request instead.

  • [x] I tried using the @types/sinon package and had problems.
  • [ ] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [ ] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @johnjesse @PranavSenthilnathan

With the delivery of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/30442, which resulted in @type/sinon version 5.0.6 being published, my builds stopped working.

I get multiple errors such as this:

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;
                             ~~~~~~~~~~~~~~

If this library is not backward compatible with TypeScript 2.9.x, shouldn't it be published as version 6 instead of 5.0.x ?

I don't know much about Typescript, but my builds are failing, my developers are 12 hours away and my investigation got me here. If I misunderstood the Types and the way they are versioned, please let me know and close this issue.

Thank.

Most helpful comment

any update?

All 13 comments

Sorry guys, should have been more attentive. The Authors of @types/sinon are:
@MrBigDog2U
@rationull
@lumaxis
@nicojs
@43081j
@JoshuaKGoldberg
@gjednaszewski

I've observed this today as well; Sinon itslef is at 6.3.5. and the update of the types from 5.0.1 to 5.0.3 has resulted in the above errors.

It also broke fakes (see #30656, #30676, whichever gets merged).

Unfortunately I guess the pr didn't get reviewed well enough.

It should be a breaking change in the DT version for sure.

This is why package locks should be used too but I do realise that's no justification for the badly versioned pr.

Ha Ha ! I knew somebody was going to mention package-lock ! :)

Many of the projects I build have them, but not all and the issue came up in a repo which is early in development and thus the developers don't bother about it yet.

It is always good to mention it anyway in such a thread.

That's fine, plenty of people don't use them for various reasons.

A breaking change was shipped as a non breaking change unfortunately it seems. I've seen it happen fairly often on DT. Maybe we could revert then reapply under a version bump. I'm not sure

hmmm, so this is my bad 馃槥, I think the revert for a new minor version and then reapply with a version bump seems reasonable. I've no idea how you bump the version though...

@andy-ms how do you suggest we deal with this?

We have two patch versions (5.0.6 and 5.0.7) which seem to increase the required typescript.

It probably should have been bumped to 6.0.0 (or 7.0.0 to keep in line with sinon's major versions).

Currently, people without a package lock who are on older typescript (<3.0) will auto-update to this which isn't supported.

Is it worth releasing 5.0.8 as a git revert of the last two merges, then release those as 6.0.0?

@43081j Is this not also an issue for all the packages that import the sinon types e.g. sinon-chai, sinon-chrome etc?

only the ones that were updated in your PR (so if that was all of them, sure).

it means their latest versions will require newer TS.

if its too tricky a thing to 'redo', i've seen packages just leave it and expect users to update their TS (with package locks its not the worst situation, but not everyone uses package locks).

depends what andy thinks tbh or another DT maintainer

any update?

also faced with the same issue on version 5.0.7. Returned to version 5.0.2 - works fine.

Downgrading to version 5.0.2 works for me as well

working on this in #30856 FYI

Was this page helpful?
0 / 5 - 0 ratings