Add regression test

This commit is contained in:
Anders Hejlsberg 2019-01-30 08:45:43 -08:00
parent e0082f6bfc
commit caa89cafde

View file

@ -0,0 +1,29 @@
// @strict
// Repro from #29520
type Test<K extends keyof any> = {
[P in K | "foo"]: P extends "foo" ? true : () => any
}
function test<T extends Test<keyof T>>(arg: T) {
return arg;
}
const res1 = test({
foo: true,
bar() {
}
});
const res2 = test({
foo: true,
bar: function () {
}
});
const res3 = test({
foo: true,
bar: () => {
}
});