decltype in C++ returns the type of an expression, for example decltype(1+1) will be int.
Note that the expression won't be executed or compiled.
Does Typescript has something similar?
Example usecase that i think should work:
const foo = () => ({a: '', b: 0});
type foo_return_type = decltype(foo());
// foo_return_type should be '{a: stirng, b: number}`
import { bar } from './some_module';
type my_type = decltype(new bar().some_method());