Incorrect typings for get
maddockst opened this issue · comments
The typings for get
are as follows:
export function get<T = object>(src: T, path?: Path, defaultValue?: any): T
However, if src
is of type T
, then the result is inevitably not going to be T
. I Feel the typings should be like this:
export function get<T = object, S = any>(src: T, path?: Path, defaultValue?: S): S
This also closer matches the typings for the object-path project which get
makes use of:
get<TResult>(object: object, path: Path, defaultValue: TResult): TResult;