// @strict: true // Repro from #30505 export type Prop = { (): T } export type PropType = Prop; export type PropDefaultValue = T; export type PropValidatorFunction = (value: T) => boolean; export type PropValidator = PropOptions; export type PropOptions = { type: PropType; value?: PropDefaultValue, required?: boolean; validator?: PropValidatorFunction; } export type RecordPropsDefinition = { [K in keyof T]: PropValidator } export type PropsDefinition = RecordPropsDefinition; declare function extend({ props }: { props: PropsDefinition }): PropsDefinition; interface MyType { valid: boolean; } const r = extend({ props: { notResolved: { type: Object as PropType, validator: x => { return x.valid; } }, explicit: { type: Object as PropType, validator: (x: MyType) => { return x.valid; } } } }) r.explicit r.notResolved r.explicit.required r.notResolved.required // Modified repro from #30505 type Box = { contents?: T; contains?(content: T): boolean; }; type Mapped = { [K in keyof T]: Box; } declare function id(arg: Mapped): Mapped; // All properties have inferable types const obj1 = id({ foo: { contents: "" } }); // Some properties have inferable types const obj2 = id({ foo: { contents: "", contains(k) { return k.length > 0; } } }); // No properties have inferable types const obj3 = id({ foo: { contains(k) { return k.length > 0; } } });