function Hoge() {
...
// A and B, both of them are different complicated object value(type).
return {A, B}
}
I want to describe only A
type on below example.
How do I get type of only A
or B
using ReturnType<T>
const A: ReturnType<typeof Hoge>
CodePudding user response:
Using Indexed Access Types, you can get the type of the property A
from the return type.
const A: ReturnType<typeof Hoge>['A']