You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceLoDashStatic{mapValues<T,TResult>(obj: {[index: string]: T},callback: (t: T)=>TResult,): {[index: string]: TResult};mapValues<Textendsobject,TResult>(obj: T,callback: (t: T[keyofT])=>TResult,): {[PinkeyofT]: TResult};}declareconst_: LoDashStatic;interfaceAbcObjectInterface{a: number;b: string;c: boolean;}typeAbcObjectRecord=Record<"a"|"b"|"c",string>;declareconstabcObjectRecord: AbcObjectRecord;declareconstabcObjectInterface: AbcObjectInterface;// Expected return type to be `{ a: number; b: number; c: string }` and got :-)// The second overload is used, as expected._.mapValues(abcObjectInterface,(v)=>1);// Expected return type to be `Record<"a" | "b" | "c", number>` but got `{ [index: string]: number }` :-(// The first overload is used, unexpectedly._.mapValues(abcObjectRecord,(v)=>1);
TypeScript Version: 2.9.1
Search Terms: overload mapped types interface
Code
Related Issues: DefinitelyTyped/DefinitelyTyped#26983 (comment)
The text was updated successfully, but these errors were encountered: