Это прекрасно работает:
const f = () => ({
a: 5,
b: "hi",
c: true
});
const a = f();
type t = typeof a; // t is {a: number, b: string, c: boolean}
Но это не работает:
const f = () => ({
a: 5,
b: "hi",
c: true
});
type t = typeof (f()); // TSLint error: "Identifier expected"
Почему это не работает? Любая идея, как определить т, не создавая?