function dosomething(type: 'type1'|'type2'){ } const type = 'type1'; dosomething(type);
function dosomething(type: 'type1'|'type2'){ } const type = 'type1' as const; dosomething(type);