Closed
Description
TypeScript Version: nightly (2.4.0-dev.20170502)
Code
interface Thing {
readonly foo: number;
}
function bar(t: Thing) { }
function qux(key: 'foo', value: number) {
bar({ foo: 5 }); // works
bar({ [key]: 5 }); // doesn't work
}
Expected behavior:
Both calls typecheck.
Actual behavior:
index.ts(9,7): error TS2345: Argument of type '{ [x: string]: number; }' is not assignable to parameter of type 'Thing'.
Property 'foo' is missing in type '{ [x: string]: number; }'.