I have some trouble trying to type a generic function with an optional parameter
type Action<TParameters = undefined> = (parameters: TParameters) => void
const A: Action = () => console.log('Hi :)')
// Ok, as expected
const B: Action<string> = (word: string) => console.log('Hello', word)
// Ok, as expected
const C: Action<string> = (word: number) => console.log('Hello', word)
// Error, as expected
const D: Action<string> = () => console.log('Hello')
// Hum, what ?!? No error ?
const E: Action<string> = (word) => console.log('Hello', word)
// No error as expected but the type inference of `word` is `any`, why ?
wordisstringin the final example you posted (see the test it yourself link).