Rule: no-inferrable-types
Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.
Rationale
Explicit types where they can be easily infered by the compiler make code more verbose.
Config
One argument may be optionally provided:
ignore-params
allows specifying an inferrable type annotation for function params. This can be useful when combining with thetypedef
rule.
Examples
"no-inferrable-types": true
"no-inferrable-types": [true, "ignore-params"]
Schema
{ "type": "array", "items": { "type": "string", "enum": [ "ignore-params" ] }, "minLength": 0, "maxLength": 1 }