-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: 3.1.0-rc.20180911
Search Terms:
TS2459
Code
function test_driver<F extends Object, R extends Object>({ arrange, act, assert }: {
arrange: () => F
act: (fixture: F) => R
assert: (fixture_and_result: F & R) => void
}) {
const f = arrange();
const r = act(f);
assert(Object.assign({}, f, r));
}
function test() {
test_driver({
arrange: () => ({ foo: "foo" }),
act: ({ foo }) => ({bar: foo + "bar"}),
assert: ({ foo, bar }) => {
// foo is "foo" and bar is "foobar" here
}
});
}
... should be compiled with --target es2017
because of the Object.assign(...)
statement
Expected behavior:
Should compile without error
Actual behavior:
...:15:25 - error TS2459: Type '{ foo: string; }' has no property 'bar' and no string index signature.
15 assert: ({ foo, bar }) => {
~~~
Playground Link: Demo on TypeScript Playground
lillallol
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed