typeof is used when you need to distinguish between types number , string , boolean , and symbol . Other string constants will not error, but won’t be used to narrow types either. Unlike instanceof , typeof will work with a variable of any type. In the example below, foo could be typed as number | string without issue.