TypeScript/tests/cases/compiler/typeInferenceWithExcessProperties.ts

31 lines
370 B
TypeScript
Raw Normal View History

2017-07-26 16:16:26 +02:00
// Repro from #17041
interface Named {
name: string;
}
function parrot<T extends Named>(obj: T): T {
return obj;
}
parrot({
name: "TypeScript",
});
parrot({
name: "TypeScript",
age: 5,
});
parrot({
name: "TypeScript",
age: function () { },
});
parrot({
name: "TypeScript",
sayHello() {
},
});