typescript/require-prop-type-annotation
Require type annotations for class properties without initializers.
Targeted pattern scope
This rule targets class PropertyDefinition nodes where both are true:
typeAnnotationis missing, andvalueisnull(no initializer).
What this rule reports
This rule reports class properties that have no initializer and no type annotation.
Why this rule exists
Uninitialized properties without annotations leave property type intent unclear.
❌ Incorrect
class C {
value;
}
✅ Correct
class C {
value: string;
}
Behavior and migration notes
This rule reports only and does not provide an autofix.
Migration is adding explicit property type annotations for uninitialized declarations.
Options
This rule has no options.
Additional examples
class User {
name = "anonymous";
// ✅ valid: initializer provides type
role;
// ❌ reported: no initializer and no annotation
}
ESLint flat config example
import etcMisc from "eslint-plugin-etc-misc";
export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/typescript/require-prop-type-annotation": "error",
},
},
];
When not to use it
Disable this rule if implicit any-style property declarations are allowed.
Package documentation
Rule catalog ID: R114
Further reading
Adoption resources
- Start at warning level in CI, then move to error after cleanup.
- Use focused codemods/autofix batches per package or directory.