agiledigital-labs / agiledigital-labs/eslint-plugin-total-functions
[total-functions/no-unsafe-readonly-mutable-assignment] False positive?
- Langage dominant
- TypeScript
- Étoiles
- 92
- Forks
- 5
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
Hi,
I'm getting the following error:
```
25:3 error Unsafe "Mutable" to "Mutable" assignment. Source: "{ c: number; } | {}", destination: "{ c: number; } | { c?: undefined; }" total-functions/no-unsafe-readonly-mutable-assignment
```
On the following code:
```
import merge from "lodash/merge";
export function mergeImmutable(v1: T1, v2: T2): T1 & T2;
export function mergeImmutable(
v1: T1,
v2: T2,
v3: T3,
): T1 & T2 & T3;
export function mergeImmutable(
v1: T1,
v2: T2,
v3: T3,
v4: T4,
): T1 & T2 & T3 & T4;
export function mergeImmutable[]>(
...args: Readonly
) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return merge({}, ...args);
}
const x = mergeImmutable(
{ a: 1 },
{ b: 2 },
Math.random() < 0.5 ? { c: 3 } : {},
);
```
I'm new to eslint-plugin-total-functions, but it seems to me that the error message doesn't make sense: it's complaining that a mutable value is being assigned to a mutable argument? Is this error being thrown incorrectly, or am I misunderstanding the message?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.