no-undefined-return-type
Disallows undefined
return types on functions.
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 and Defaults
{
"rules": {
"complete/no-undefined-return-type": "error"
}
}
This rule is not configurable.