I have the following function:
function test(): number { return 42; }
I can obtain the type of the function by using typeof
typeof
There isn't a way to do this (see https://github.com/Microsoft/TypeScript/issues/6606 for the work item tracking adding this).
A common workaround is write something like:
var dummy = false && test(); type t2 = typeof dummy;