News for hackers. Stuff that matters.
Re:TypeScript 3.7 by dstaley on Tuesday November 05, 2019 @07:17PM (#21458445)
I'm super excited about this release, but it got off to a rocky start for me. Prior to 3.7, all our tests worked fine, but something in 3.7 changed that caused the type-checker to fail previously valid code. What's worse is that I can't reproduce the issue in a playground. Thankfully the workaround is "make your code more explicit", which is fine, but it was just a surprise to see something like this break.

For those that are curious, here's the error that 3.7 introduced:

  Type 'SinonStub<[string, RequestBody, (RequestOptions | undefined)?], KintoRequest>' is not assignable to type 'SinonStub<any[], any>'.
  Type 'any[]' is missing the following properties from type '[string, RequestBody, (RequestOptions | undefined)?]': 0, 1
I think the issue here is that `[string, RequestBody, (RequestOptions | undefined)?]` is a tuple type, and `any[]` is an array type. That being said though, I'd expect that a tuple would satisfy a `any[]` type.
Re:TypeScript 3.7 by rraval on Tuesday November 05, 2019 @08:05PM (#21458738)
> That being said though, I'd expect that a tuple would satisfy a `any[]` type.

You have it backwards, the error in question is complaining that `any[]` does not satisfy the tuple type.

Minimal repro:

    function f(x: any[]): [number, string] {
        return x;
    }
The error matches yours:

    Type 'any[]' is missing the following properties from type '[number, string]': 0, 1
From poking the playground, `any[]` hasn't been assignable to tuples since at least v3.3.3

My guess is that the compiler got smarter around reasoning about your `SinonSub` generic and is now forcing you to deal with lingering unsoundness.

Re:TypeScript 3.7 by dstaley on Tuesday November 05, 2019 @08:10PM (#21458766)
Yeah, that's my assumption as well. It would explain why there's no mention of it in breaking changes, and why being specific about the generics in `SinonStub` fixes the error.

Makes me wonder what other unsoundness the compiler isn't catching.

Re:TypeScript 3.7 by dickeytk on Tuesday November 05, 2019 @07:38PM (#21458585)
Keep in mind that TypeScript does make breaking changes in point releases. They don’t ascribe to semver. Not sure if that’s your issue or a bug though