Looking at the scenario provided below, how can we enhance code reusability in a manner similar to foobarA
?
interface F<T, U extends string> { t: T, f: (u: U) => void }
declare const foo: <T, U extends string>(type: U) => F<T, U>;
// the following correctly types foobar, however 'bar' redundantly repeats.
const foobar = foo<string, 'bar'>('bar')
// ideally one would want the generic inference to be smarter and the
// following to work:
const foobarA = foo<string>('bar')