Repository: TypeScript
Issue: Equivalent arguments typed with tuples aren't assignable to the same functions with overloads when the same function is recursively referenced
Labels: Suggestion,Awaiting More Feedback

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms

arguments, overloads, function, tuple

<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->

### 🕗 Version & Regression Information

All versions with support for tuple arguments (upto v4.5.0-dev.20210815).

<!-- When did you start seeing this bug occur?

"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs

If possible, please try testing the nightly version of TS to see if it's already been fixed.
For npm: `typescript@next`
This is also the 'Nightly' version in the playground: http://www.typescriptlang.org/play/?ts=Nightly

Note: The TypeScript Playground can be used to try older versions of TypeScript.

Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about function overloading (there is nothing in the FAQ about tuples)

### ⏯ Playground Link

<!--
  A link to a TypeScript Playground "Share" link which shows this behavior

  The TypeScript Workbench can be used for more complex setups, try
  https://www.typescriptlang.org/dev/bug-workbench/

  As a last resort, you can link to a repo, but these will be slower for us to investigate.
-->
[Playground link with relevant code](https://www.typescriptlang.org/dev/bug-workbench/?ts=4.5.0-dev.20210815#code/C4TwDgpgBAygKgQQEpygXigBgFCklAEQUXSgEZtdxoEAnAcwGcAeASQDsAaKAeQFdgAPnTYoUAD5QA2sABcsRCm4B7YAAsIteQDF2AdQCW6uk2b9g3DoIC6oidLmFiCW1Xy7Dxhiw7dzwjAAKADpQgENveRMfLl4BQQBKdGEAN2UDABNKA3ZgTQAzMIBjaA8jNR4UzQAbZTCMmL94qABvO0DHeGQ4FXVNHX1yypq6hrMBS3ZE+TTMgG52xyJEBJn0jIWAX0oMiCLqiOgi5XZGYCgAd3Logc81aOYybgAmQUoAeneoPsZoRjVlHxqhkoAAjaBhRiMAz0dhhUHVaDAZRQE4Q9iqDS0biggRQQ7sADkcmwx1O50hv1owAMJ1uQyqtFq9RYTygr1IVy8TGwQA)

### 💻 Code


```ts repro
type START = 0
type DATA = 1

type Args<In, Out> =
  | [t: START, other: FnWithArgs<Out, In>]
  | [t: DATA]

type FnWithArgs<In, Out> = (...args: Args<In, Out>) => void

interface FnWithOverloads<In, Out> {
  (t: START, other: FnWithOverloads<Out, In>): void;
  (t: DATA): void;
}

declare const withArgs: FnWithArgs<1, 2>

// these should be assignable to one another, but aren't:
const assertion: FnWithOverloads<1, 2> = withArgs
```

### 🙁 Actual behavior

Two types that should be functionally equivalent aren't assignable to one another:

```
Type 'FnWithArgs<1, 2>' is not assignable to type 'FnWithOverloads<1, 2>'.
  Types of parameters 'args' and 't' are incompatible.
    Type '[t: 0, other: FnWithOverloads<2, 1>]' is not assignable to type 'Args<1, 2>'.
      Type '[t: 0, other: FnWithOverloads<2, 1>]' is not assignable to type '[t: 0, other: FnWithArgs<2, 1>]'.
        Type at position 1 in source is not compatible with type at position 1 in target.
          Type 'FnWithOverloads<2, 1>' is not assignable to type 'FnWithArgs<2, 1>'.
            Types of parameters 't' and 'args' are incompatible.
              Type 'Args<2, 1>' is not assignable to type '[t: 0, other: FnWithOverloads<1, 2>]'.
                Type '[t: 1]' is not assignable to type '[t: 0, other: FnWithOverloads<1, 2>]'.
                  Source has 1 element(s) but target requires 2.
```

I've tried simplifying the example, and this issue doesn't seem to occur when the parameters of the function don't reference themselves in their signature. 

<!-- What happened, and why it was wrong -->

### 🙂 Expected behavior

No error, types should be assignable to one another.

<!-- What you expected to happen instead, and why -->

### Related issues

- https://github.com/microsoft/TypeScript/issues/29732
- https://github.com/microsoft/TypeScript/issues/32164