sweet-monads icon indicating copy to clipboard operation
sweet-monads copied to clipboard

Fixed types of Either.fromTry

Open wookieb opened this issue 3 years ago • 7 comments

Addresses comment: https://github.com/JSMonk/sweet-monads/pull/53#issuecomment-1494852272

wookieb avatar Apr 04 '23 05:04 wookieb

Hey. It looks like the typing is good now because you can provide the types by generic types application. Why did you decide to change them?

JSMonk avatar Jul 16 '23 21:07 JSMonk

I saw the issue, but, let's just change the documentation. Could I ask you to do the separated PR?

JSMonk avatar Jul 16 '23 21:07 JSMonk

@JSMonk I've updated readme within that PR. Did I miss some part of documentation?

wookieb avatar Jul 19 '23 08:07 wookieb

No, your PR is great, I just want to split it in two: one with the changes to the readme, and another one with all the logic

JSMonk avatar Jul 19 '23 09:07 JSMonk

I can. What's the benefit of it though?

wookieb avatar Jul 19 '23 09:07 wookieb

Seems like that in the case of throwing an error inside the function provided to the fromTry function, the type of the error will be not inferenced by TypeScript, so, this is the issue of the documentation. I would like to fix it separately (I could do it by myself), but removing of the generic parameter it's another task that I would like to discuss before the merging (at least, it will be great to not remove the parameter, but provide the unknown as a default value for the type parameter)

JSMonk avatar Jul 19 '23 11:07 JSMonk

Docs in another PR: https://github.com/JSMonk/sweet-monads/pull/66

wookieb avatar Jul 23 '23 06:07 wookieb