mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 10:41:56 -05:00
• A type guard of the form typeof x === s, where s is a string literal with the value ‘string’, ‘number’, or ‘boolean’, o when true, narrows the type of x to the given primitive type, or o when false, removes the primitive type from the type of x. • A type guard of the form typeof x === s, where s is a string literal with any value but ‘string’, ‘number’, or ‘boolean’, o when true, removes the primitive types string, number, and boolean from the type of x, or o when false, has no effect on the type of x. • A type guard of the form typeof x !== s, where s is a string literal, o when true, narrows the type of x by typeof x === s when false, or o when false, narrows the type of x by typeof x === s when true.