eslint-plugin-total-functions icon indicating copy to clipboard operation
eslint-plugin-total-functions copied to clipboard

New rule: prevent unsafe assignment of fp-ts types

Open danielnixon opened this issue 1 year ago • 2 comments

export const foo: IO<string> = () => "hello";

// These assignments compile because the types are compatible, but the semantics are such that doing so is almost certainly an error.
export const bar: Lazy<string> = foo;
export const baz: () => string = foo;

danielnixon avatar Mar 11 '23 05:03 danielnixon

We should also catch when a Promise is being assigned to an IO like IO.of(Axios.get(...)), or any async effect being assigned to an IO for that matter.

danielnixon avatar Mar 15 '23 08:03 danielnixon

That latter point is covered by total-functions/no-nested-fp-ts-effects

danielnixon avatar Mar 15 '23 21:03 danielnixon