Code Inspection: Unsound type guard check
Reports a typeof or instanceof unsound type guard check. The typeof x type guard can be unsound in one of the following two cases:
typeof xnever corresponds to the specified value (for example,typeof x === 'number'whenxis of the type 'string | boolean')typeof xalways corresponds to the specified value (for example,typeof x === 'string'whenxis of the type 'string')
The x instanceof A type guard can be unsound in one of the following two cases:
The type of
xis not related toAThe type of
xisAor a subtype ofA
Suppress an inspection in the editor
Place the caret at the highlighted line and press Alt+Enter or click
.
Click the arrow next to the inspection you want to suppress and select the necessary suppress action.
Last modified: 13 May 2022