I've seen an API list methods with both of the following signatures:
methodA(...) : ReturnType methodB(...) : typeof ReturnType
I understand the first but not the second.
initTestEnvironment(ngModule: Type<any>, platform: PlatformRef) : TestBed configureTestingModule(moduleDef: TestModuleMetadata) : typeof TestBed
My understanding is that the first line means that when you call this method the return value will be an object of type
TestBed. That makes sense to me.
However, I don't understand the type of the return value in the second line. Is the return value of this method an object of type
typeof TestBed? The JS operator
typeof returns a string, so how can you have an object of type
"Anything" instead of
Anything, i.e. a string versus a class/interface/etc.?
I am primarily interested in an explanation of this method signature syntax. However I would also very much appreciate a link to an (official?) online source describing this shorthand/syntax.
By the way, I presume that the syntax of this method signature is specific to TypeScript, but please correct me if I'm wrong about that.
(I have attempted googling this question several ways, including keeping an eye out for StackExchange discussions, and have come up empty-handed. There is a question on StackOverflow that asks "What is the return type of typeof?" which is completely unrelated. Other searches quickly disintegrate into Google separating
"type of" which is also completely unhelpful.)