Looking for a way to define a function in TypeScript that will accept, as one of it's arguments, a function that may be of different signatures

```js
const foo = (a: string, b: number) => {
  //do something
}

const bar = (a: number, b: string, c: boolean) => {
  //do something
}

const myDynamicFunction = (
  str: string,
  // I tried this, but no dice
  method: ((a: string, b: number) => void) | ((a: number, b: string, c: boolean) => void), 
  num: number,
  bool?: boolean
) => {
  if (bool) {
    method(num, str, bool)
  } else {
    method(str, num)
  }
}

myDynamicFunction(
  'string', foo, 5
)

myDynamicFunction(
  'string', bar, 5, true
)

```

I tried going down the "function overloads" rabbit hole, but that just left me where I started w/ essentially the same error of unexpected number of arguments.