Question #258

Author: admin
tags: TypeScript  
function getX(num: 1|2) {
  if (num === 1) return 'aaa';
  if (num === 2) return 100;
  throw new Error('Wrong num');
}

const x = getX(1); // ??
What is the type of the x variable?
any
'aaa' | 100
'aaa'
string | number
string
Rate the difficulty of the question:
easyhard