typescript set type of variable code example Example: angular type of string if(typeof myVariable === 'string'){ //do }