Argument type ...{}[] is not assignable to parameter type {}

Hello,

I was trying to combine objects returned from different promises, by using a spread operator on the returned array and Object.assign. I got a weak warning saying that the argument type is not assignable, which is weird since the code works. I simplified the code down to the bare minimum that will reproduce the warning. The code works but I don't like having warnings even if they're weak ones. Is this warning a bug or is something wrong with my code?

The code for easy copy&paste:

const foo = new Promise(resolve => resolve());

const bar = Promise.all([
foo.then(() => ({baz: 1}))
]);

bar.then(values => Object.assign({}, ...values))
.then(object => console.log(object));
1
1 comment

Please sign in to leave a comment.