traverse1984 / oxide.ts

Rust's Option<T> and Result<T, E>, implemented for TypeScript.
MIT License
517 stars 19 forks source link

andThen "f" argument is wrongfully typed #22

Closed SteakOvercooked closed 9 months ago

SteakOvercooked commented 10 months ago

Doc comments say that the usage of andThen goes like this:

const opt = Some(1).andThen((val) => val + 1);

Which is wrong because it actually expects you create an Option with the result:

const opt = Some(1).andThen((val) => Some(val + 1));