no-undefined-return-type
💼 This rule is enabled in the ✅ recommended
config.
Disallows undefined
return types on functions.
💠This rule requires type information.
Rule Details​
A function that only returns undefined
is confusing and likely to be a mistake, since a function that returns nothing should have a return type of void
.
// Bad
function foo(): undefined {
return;
}
// Good
function foo(): void {
return;
}
// Bad
function foo() {
return undefined;
}
// Good
function foo() {
return;
}
Options​
This rule is not configurable.