Question #190

Author: admin
tags: TypeScript  
type SomeType<T> = T extends { amount: number }
  ? T['amount'] : T extends { planet: string } ? T['planet'] : boolean;

const x = { planet: 'Mars' };

type MyType = SomeType<typeof x>;
What is the type of MyType?
{ planet: string }
{ planet: 'Mars' }
'Mars'
number
string
boolean
number|string|boolean
Rate the difficulty of the question:
easyhard