Repository: TypeScript
Issue: Poor error message due to Iterable overload in Promise.all
Labels: Suggestion,Needs Proposal,Domain: Error Messages

Found in #46651

# Bug Report

[Playground Link](https://www.typescriptlang.org/play?ts=4.6.0-dev.20211103#code/JYOwLgpgTgZghgYwgAgIIAd0BsIGdkDeyYAnuhAFzIBEcmOu1yAvgLABQoksiKAQnBCC4+IsTKUaAI2FDGLDhwAmEBFjhQUMAK4gEYYAHsQyAOYQwGbHgAUASioAFKIYC2wXBAA8VhgG0AXQA+AG5lVXVNZB09A2MzCwEQQ2MU3HsnF3dPLyThXEDQxXYVNQ0tXX0jE1MUpWc3DwhULCwvABVkCAAPSBAlfE04JWMsEmRdAGtkgHcQQOQAH2RCmwA3OCxtPCp2h2QG7O8iAFohkZAxlcdkUGRJiBJDGGR2gKpUGbhgSCUOv0cwRYRXY4TKURiVXiMnqWSaLTa7SC60221wVAAktw4FIcB0lgc4Z4ADLAB4dIJBfaHJo+L4-CB-JGFMIlCLlaKVOImGE0zwI-E9PoDZDnUbjKazeYBAmrDZbHavalE47IM4QYbi663EwPJ4vN4fem-f6AoLA1kcEQkPSc2LVBJgPhQQQIAAWeAA8lB2nBTOkEMYlD9qgB+KhSFI4QR2QgcZAJ5BwY3IXkqgV+Xx4BbLXQqGCgRkAGmQeTkOYm-QgBZAjOCNj88cTzcD-RD8VDjqz6VjVDz1cLSiLTebCdbwe5yE75idghSyUMPeQfarNeLI+QATsrOYQA)

```ts
interface Apples { type: "apples" }
interface Bananas {  type: "bananas" }

declare function getApples(): Promise<Apples[]>;
declare function getBanoonoos(): Promise<Bananas[]>;

declare function goodPromiseAll<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;

declare function badPromiseAll<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
declare function badPromiseAll<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]> }>;

async function getBranchesOrTags(condition?: boolean) {
    await badPromiseAll<[Apples[] | undefined, Bananas[] | undefined]>([
        condition ? getApples() : undefined,
        condition ? getBanoonoos() : undefined,
    ]);
swa}
```

Try swapping between `goodPromiseAll` and `badPromiseAll`.

Notice that the errors on `goodPromiseAll` are

```
|         condition ? getApples() : undefined,
|         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Type 'Promise<Bananas[]> | undefined' is not assignable to type 'Bananas[] | undefined'.
  Type 'Promise<Bananas[]>' is missing the following properties from type 'Bananas[]': length, pop, push, concat, and 26 more.

|         condition ? getBanoonoos() : undefined,
|         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Type 'Promise<Apples[]> | undefined' is not assignable to type 'Apples[] | undefined'.
  Type 'Promise<Apples[]>' is missing the following properties from type 'Apples[]': length, pop, push, concat, and 26 more.
```


and on `badPromiseAll` there's one bad error:

```
| async function getBranchesOrTags(condition?: boolean) {
|     await badPromiseAll<[Apples[] | undefined, Bananas[] | undefined]>([
|                                                                        ~        
|         condition ? getApples() : undefined,
|         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|         condition ? getBanoonoos() : undefined,
|         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|     ]);
|     ~

No overload matches this call.
  Overload 1 of 2, '(values: Iterable<[Apples[] | undefined, Bananas[] | undefined] | PromiseLike<[Apples[] | undefined, Bananas[] | undefined]>>): Promise<...>', gave the following error.
    Argument of type '(Promise<Apples[]> | Promise<Bananas[]> | undefined)[]' is not assignable to parameter of type 'Iterable<[Apples[] | undefined, Bananas[] | undefined] | PromiseLike<[Apples[] | undefined, Bananas[] | undefined]>>'.
      The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
        Type 'IteratorResult<Promise<Apples[]> | Promise<Bananas[]> | undefined, any>' is not assignable to type 'IteratorResult<[Apples[] | undefined, Bananas[] | undefined] | PromiseLike<[Apples[] | undefined, Bananas[] | undefined]>, any>'.
          Type 'IteratorYieldResult<Promise<Apples[]> | Promise<Bananas[]> | undefined>' is not assignable to type 'IteratorResult<[Apples[] | undefined, Bananas[] | undefined] | PromiseLike<[Apples[] | undefined, Bananas[] | undefined]>, any>'.
            Type 'IteratorYieldResult<Promise<Apples[]> | Promise<Bananas[]> | undefined>' is not assignable to type 'IteratorYieldResult<[Apples[] | undefined, Bananas[] | undefined] | PromiseLike<[Apples[] | undefined, Bananas[] | undefined]>>'.
              Type 'Promise<Apples[]> | Promise<Bananas[]> | undefined' is not assignable to type '[Apples[] | undefined, Bananas[] | undefined] | PromiseLike<[Apples[] | undefined, Bananas[] | undefined]>'.
                Type 'undefined' is not assignable to type '[Apples[] | undefined, Bananas[] | undefined] | PromiseLike<[Apples[] | undefined, Bananas[] | undefined]>'.
```

I don't understand why we always use the `Iterable` overload in `badPromiseAll` regardless of the ordering.

### 🕗 Version & Regression Information

4.5, nightly