How can I convince TSServer that I'm using lodash/fp instead of lodash?

34 Views Asked by At

Currently, though, several type errors are erroneously detected in my JavaScript files, all boiling down to the engine thinking I'm using "standard" lodash, where the following makes sense,

const a = _.groupBy([], _.isEqual);

whereas I'm using lodash/fp, where _.groupBy (like many other functions) takes the range argument as the last argument,

const a = _.groupBy(_.isEqual, []);

So the former is erroneusly accepted, and the latter is erroneously marked as error:

No overload matches this call.
  Overload 1 of 2, '(collection: List<[]>, iteratee?: ValueIteratee<[]>): Dictionary<[][]>', gave the following error.
    Argument of type '(value: any, other: any) => boolean' is not assignable to parameter of type 'List<[]>'.
      Index signature for type 'number' is missing in type '(value: any, other: any) => boolean'.
  Overload 2 of 2, '(collection: (value: any, other: any) => boolean, iteratee?: ValueIteratee<never>): Dictionary<never[]>', gave the following error.
    Argument of type '[]' is not assignable to parameter of type 'ValueIteratee<never>'.
      Type '[]' is not assignable to type '[PropertyName, any]'.
        Source has 0 element(s) but target requires 2.

I've also asked on DefinitelyTyped, however the answer assumed I was using TypeScript, whereas I just have an HTML file where I'm including lodash/fp from a CDN via a <script> tag:

<script src="https://cdn.jsdelivr.net/g/lodash@4(lodash.min.js+lodash.fp.min.js)"></script>

How can I convince TSServer that I'm using lodash/fp?

0

There are 0 best solutions below