I'm trying to work with a library that imports fp-ts and exports a function with an Either<string, string> return value. However, an attempt to store the return value in variable with Either<string, string> type causes the compiler to run out of memory. I can get the code to compile by replacing the library Either with local Either by doing libraryCall(...args).fold(left, right), however this makes the code confusing since one would expect the two Either types to be compatible since they both originate from fp-ts.
It's this issue:
https://github.com/microsoft/TypeScript/issues/30429
The v2 branches coming soon don't exhibit the issue because there are no classes for it to choke on comparing.
What is the first TypeScript version number where this should work?
Version 3.5.0-dev.20190525 seems to still have the problem :-/
Never mind. Seems to work after all.
Actually, The problem still happens when you use npm link to link two packages.
I added a comment on microsoft/TypeScript#30429
This problem might not exist at all in fp-ts 2.
I did encounter this problem several times in fp-ts v1, but haven't seen it since v2. Which makes sense, because that was one of many reasons for moving away from the previous class-based approach. Closing this issue now, should it turn out to still be an issue, feel free to reopen.
Most helpful comment
https://github.com/microsoft/TypeScript/pull/31541