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 inferred by the compiler make code more verbose.
Notes:
TS Only
Has Fixer
Config
Two arguments may be optionally provided:
ignore-paramsallows specifying an inferrable type annotation for function params. This can be useful when combining with thetypedefrule.ignore-propertiesallows specifying an inferrable type annotation for class properties.
Config examples
"no-inferrable-types": true
"no-inferrable-types": [true, "ignore-params"]
"no-inferrable-types": [true, "ignore-params", "ignore-properties"]
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"ignore-params",
"ignore-properties"
]
},
"minLength": 0,
"maxLength": 2
}