Nucleus handler tools › Docs › Checks

A typeof check that is never true

Warningvalid-typeofA general JavaScript mistake (ESLint's valid-typeof) · Probably wrong: Nucleus runs it, but not the way you meant.

Why it matters

typeof only gives "undefined", "object", "boolean", "number", "string" or "function": this comparison is never true (a typo?).

Example

✗ Wrong

var a = 1;
if (typeof a == "numbr") {
}

✓ Right

var a = 1;
if (typeof a == "number") {
}

How to fix it

Fix the spelling of the type name.

Turn it off, or change how it shows

Each check can be shown as an error, warning, info or hint, or turned off. VS Code: "splitscreenme.lint.rules": { "valid-typeof": "off" } in your settings. Notepad++: Plugins › Nucleus Co-op handlers › Settings. Command line: ncdev lint --rule valid-typeof=off. Other editors: the lint.rules setting of ncdev lsp.

Is this right? Tell us what's wrong
Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop