lodash _.keyBy() converts number to string

Viewed 261

is there a way for this conversion to be avoided? I see there's this interface

interface NumericDictionary<T> {
    [index: number]: T;
}

but can't figure out how to use it

1 Answers

you can do this by typing the result i.e.

res: Record<number, value> = _.keyBy(x, 'path')

Related