menu

no-return-assign

Disallow assignment within an explicit or implicit return value

A returned assignment makes the assigned value the function result after mutating its target, and a single = can be mistaken for an equality operator. Instead, you SHOULD perform the assignment as a statement and return the resulting value separately.

Reported

1function reset(value: int32): int32 {2    let current = value;3    return (current = 0);4}

Accepted

1function reset(value: int32): int32 {2    let current = value;3    current = 0;4    return current;5}