'Typescript ReturnType issue

Im trying to get the correct return type based on the method key of an interface. Typescript is showing an issue here but i cant work out why.

interface Provider {
  reboot?(a: string): (string | null)[]
  cc?(): Promise<string>
}
type ProviderReturn<K extends keyof Provider> = ReturnType<Provider[K]>

Playground



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source