Skip to contentSlop Block

no-runtime-typeof

Warning

Avoid typeof narrowing, except comparisons with "undefined".

if (typeof input === "string")Parse the value at the boundary instead of narrowing it with typeof	useName(input);
switch (typeof value) {Parse the value at the boundary instead of narrowing it with typeof	case "number":		break;}
// ast-grep-ignore: no-runtime-typeof-typescript

How to fix

Comparing with "undefined" is allowed, since it checks that a binding exists.