StrandedKitty/straight-skeleton

TS2769: No overload matches this call

Closed this issue · 2 comments

I suddenly get this exception when compiling my TS code (including an import of this library).

node_modules/straight-skeleton/src/lib/Utils.ts:4:19 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
    Argument of type 'T[]' is not assignable to parameter of type 'ConcatArray<never>'.
      The types returned by 'slice(...)' are incompatible between these types.
        Type 'T[]' is not assignable to type 'never[]'.
          Type 'T' is not assignable to type 'never'.
  Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
    Argument of type 'T[]' is not assignable to parameter of type 'ConcatArray<never>'.

4  return [].concat(array.slice(0, index), items, array.slice(index));```

It used to work so I'm not sure what changed, but here it is.

I'm using TypeScript **4.7.4** in case that matters.

Honestly, I don't understand why your project cares about anything except the dist folder (which contains the build and .d.ts files).

I can't reproduce this issue with your version of typescript. There's probably more to it than just the version.

Apparantly my IDE had overzealoously added this as an import:

import {GeoJSONMultipolygon} from 'straight-skeleton/src/lib/Utils';

Once I replaced it with
import {GeoJSONMultipolygon} from 'straight-skeleton';
it obviously worked fine.

Sorry for not spotting that :-)