// This should behave the same as emptyObjectNotSubtypeOfIndexSignatureContainingObject2.ts // Begin types from Lodash. interface Dictionary { [index: string]: T; } interface NumericDictionary { [index: number]: T; } type ObjectIterator = ( value: TObject[keyof TObject], key: string, collection: TObject ) => TResult; type DictionaryIterator = ObjectIterator, TResult>; // In lodash.d.ts this function has many overloads, but this seems to be the problematic one. function mapValues( obj: Dictionary | NumericDictionary | null | undefined, callback: DictionaryIterator ): Dictionary { return null as any; } // End types from Lodash. interface Foo { foo: string; } interface Bar { bar: string; } export function fooToBar( foos: Record ): Record { const result = foos == null ? {} : mapValues(foos, f => f.foo); // This line _should_ fail, because `result` is not the right type. return result; }