Before I submit a ticket on github, I want to double-check that I'm not making any mistakes. The issue should be clear enough:
class A {}
class B {
static A = A;
}
function foo<T>(arg: T) {}
// this is valid
const b = new B.A;
// "B" only refers to a type, but it's being used as a namespace.
foo<B.A>(1);
Am I correct in assuming that I can reference a type like this?
While the instantiation deduces the types correctly as:
b = A
B.A = typeof A
B = B
It gives this inference for the last line:
B = any
As a result, VS Code can navigate to the definition for the first one, but struggles to find references for the second.
This appears quite strange to me.
UPDATE: The initial response I received turned out to be incorrect, as this syntax results in a typeof of a typeof:
// arguments of type "A" cannot be assigned to parameters of type "typeof A", property "prototype" is missing.
foo<(typeof B)['A']>(b);
Even if I specify an explicit constructor type, things only get more complicated:
// this will make things worse
class B {
static A: { new (): A } = A;
}