Repository: TypeScript
Issue: Missing arguments in a callback function within a decorator result in error
Labels: Needs Investigation

# Bug Report

In TS 5.1.3 when writing decorators that use the `experimentalDecorators` setting, 
and writing a decorator that receives a callback function in the factory, which it calls with the function `this` context and arguments, then TS fails with `Unable to resolve signature of method decorator when called as an expression.` when the callback function has not defined the argument in its callback, but works when it is present even if unused.

This even happens if the callback function is explicitly typed to also accept a version that does not take arguments.

### 🔎 Search Terms

Decorators, experimentalDecorators

### 🕗 Version & Regression Information
TS 5.1.3
`experimentalDecorators` enabled

### ⏯ Playground Link

[Playground Link](https://www.typescriptlang.org/play?experimentalDecorators=true&ts=5.1.3#code/C4TwDgpgBAMg9gcwGIDsA8BhANFAglCAD2AhQBMBnKAQxRAG0BdAPigF4oAKYACwEsKALijYoAOgnUATgiF4AlO1YVgUvigQAoAGYBXFAGNgfOCliIE6hABEIBuFOrAHmHPiIlyVWgxacA3lAANohQAL7CgSEIwvDI6KK4rGGK-ppQUFIQwLpSZnqGxqZc6RlQAPrA0gjZwtilGeUAttk8cGQActQtwipqGlgNUGQQFAZqYM5SwgAq4BBkAApScJBSoLZjE1No3PxyohJi1XK4imysy3BNAhBoPszMpalD9igqUA58lijUQQCyrXa7GGo3GfEmDjEADc-roIJohiMthCpjC4dAOAUjCYzHsBHUcEcTsIzlA0mUym8PlkKLogsAQdFjmAwEEQPiKDgTvIhhlqXAghAxNFOLT6cBeZSMlkcnlPmofn9Abx2gBCFlsjm8ATcmQUKVlMKlY3GzQGILUChUDq6JoAIwgUgAyk7oXwDNAKVAwGpYSQoCg7Y6pCCAAylAD0kagM32BCkKykFFKAAE4j8bHYHE4HAEhqKXtLMtlcmYAAYkFQAWgAJP4dRQxEGHU6wuWhmFBhkUqUrSBDFAKNlba2pJxYUF4cIWyH5MIrjdh2hZ07WN6Mo3m8GnSDJ-ChrKy1At6upCbERlo7H4wB3BwAayo2nUCIy6YsVls9kcU3zlNFcozyLaUj3lStRmAOsG32bcx3bTtu3CQ1+0HYdgFHEMACYJwxGcdykecoEXW4VwI9chlPAi9wxQ9S3lKixwvMIgA)

### 💻 Code
```ts
type LogFn<C, A extends any[]> = (this: C, ...args: A) => string
function LoggingDecorator<C, A extends any[]>({ log }: { log: LogFn<C, A> }) {
  return function (
    _target: C,
    _methodName: string,
    descriptor: TypedPropertyDescriptor<(this: C, ...args: A) => Promise<any>>
  ) {
    const originalMethod = descriptor.value

    descriptor.value = function (this: C, ...args: A) {
      const result = log.apply(this, args)
      console.log(result)
      return originalMethod!.apply(this, args)
    }
  }
}

class NumberService {
  private number = 0
  // This errors
  @LoggingDecorator({
    log() {
      return `test-${this.number}`
    },
  })
  async setNumber(value: number): Promise<number> {
    this.number = value
    return this.number
  }

  // This works fine
  @LoggingDecorator({
    log(_number) {
      return `test-${this.number}`
    },
  })
  async setNumber2(value: number): Promise<number> {
    this.number = value
    return this.number
  }
}
```

### 🙁 Actual behavior

TS errors with

```
Unable to resolve signature of method decorator when called as an expression.
  Argument of type 'TypedPropertyDescriptor<(value: number) => Promise<number>>' is not assignable to parameter of type 'TypedPropertyDescriptor<(this: NumberService) => Promise<any>>'.
    Types of property 'value' are incompatible.
      Type '((value: number) => Promise<number>) | undefined' is not assignable to type '((this: NumberService) => Promise<any>) | undefined'.
        Type '(value: number) => Promise<number>' is not assignable to type '(this: NumberService) => Promise<any>'.ts(1241)
```

### 🙂 Expected behavior

TS accepts the function even without arguments.