I expect the void [] type to be compatible with the void type. In particular, when using Promise.all.
class Foo {
delete(): Promise<void> {
return Promise.resolve();
}
deleteMany(list: Foo[]): Promise<void> {
return Promise.all(list.map((x) => x.delete()));
}
typescript error:
'Type' Promise <void []> 'is not assigned to the type "Promise <void>". The type 'void []' is not assigned to the type 'void'. ''
I can solve these two ways that I know of:
The second one is worse because this bit of code is executed in JavaScript, but the first one confuses developers. Does Typescript have poor support for Promise.all or is it not listed in their documentation? Anyone find a better solution?