Why does the extends clause succeed when checking whether a 0-arity function extends a 1-arity type?
Is there any way to make the first form work?
The same check on tuples works as I'd expect, so I can use Parameters instead, but I'm curious as to why.
function foo(bar: number) {
// ...
}
function baz() {
// ...
}
type Foo = typeof foo extends (bar: infer T) => void ? T : never; // number - expected number
type Baz = typeof baz extends (bar: infer T) => void ? T : never; // unknown - expected never
type Foo2 = Parameters<typeof foo> extends [infer T] ? T : never; // number - ok
type Baz2 = Parameters<typeof baz> extends [infer T] ? T : never; // never - ok