fp-ts: Compile errors when using TypeScript 2.4.1
I just tried using the latest fp-ts (currently 0.3.4) with typescript@next
(currently 2.5.0-dev.20170622), and I got this error, among others. Do you have any ideas what could be wrong here? Is TypeScript catching a genuine bug?
node_modules/fp-ts/lib/Option.d.ts(20,22): error TS2420: Class 'None<A>' incorrectly implements interface 'FantasyTraversable<"Option", A>'.
Types of property 'traverse' are incompatible.
Type '<F extends "Task" | "Option" | "Either" | "io-ts/Type">(applicative: Applicative<F>) => <B, U = a...' is not assignable to type '<F extends "Task" | "Option" | "Either" | "io-ts/Type">(applicative: Applicative<F>) => <B, UF = ...'.
Type '<B, U = any, V = any>(f: (a: A) => HKT<B, U, V>[F]) => HKT<Option<B>, U, V>[F]' is not assignable to type '<B, UF = any, UT = any, VF = any, VT = any>(f: (a: A) => HKT<B, UF, VF>[F]) => HKT<Option<B>, UF,...'.
Type 'HKT<Option<{}>, any, any>[F]' is not assignable to type 'HKT<Option<B>, UF, VF>[F]'.
Type 'Task<Option<{}>> | None<Option<{}>> | Some<Option<{}>> | Left<any, Option<{}>> | Right<any, Optio...' is not assignable to type 'HKT<Option<B>, UF, VF>[F]'.
Type 'Task<Option<{}>>' is not assignable to type 'HKT<Option<B>, UF, VF>[F]'.
Type 'Task<Option<{}>>' is not assignable to type 'Task<Option<B>> | None<Option<B>> | Some<Option<B>> | Left<UF, Option<B>> | Right<UF, Option<B>> ...'.
Type 'Task<Option<{}>>' is not assignable to type 'Task<Option<B>>'.
Type 'HKT<Option<{}>, any, any>[F]' is not assignable to type 'Task<Option<B>> | None<Option<B>> | Some<Option<B>> | Left<UF, Option<B>> | Right<UF, Option<B>> ...'.
Type 'Task<Option<{}>> | None<Option<{}>> | Some<Option<{}>> | Left<any, Option<{}>> | Right<any, Optio...' is not assignable to type 'Task<Option<B>> | None<Option<B>> | Some<Option<B>> | Left<UF, Option<B>> | Right<UF, Option<B>> ...'.
Type 'Task<Option<{}>>' is not assignable to type 'Task<Option<B>> | None<Option<B>> | Some<Option<B>> | Left<UF, Option<B>> | Right<UF, Option<B>> ...'.
Type 'Task<Option<{}>>' is not assignable to type 'Task<Option<B>>'.
Type 'Option<{}>' is not assignable to type 'Option<B>'.
Type 'None<{}>' is not assignable to type 'Option<B>'.
Type 'None<{}>' is not assignable to type 'None<B>'.
Type '{}' is not assignable to type 'B'.
Type 'HKT<Option<{}>, any, any>[F]' is not assignable to type 'Type<Option<B>>'.
Type 'Task<Option<{}>> | None<Option<{}>> | Some<Option<{}>> | Left<any, Option<{}>> | Right<any, Optio...' is not assignable to type 'Type<Option<B>>'.
Type 'Task<Option<{}>>' is not assignable to type 'Type<Option<B>>'.
Property 'name' is missing in type 'Task<Option<{}>>'.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 40 (19 by maintainers)
If only I could convince my product manager
I feel like the API actually got a bit prettier this way without all the quote noise. 😃
@gcanti I just tried updating to io-ts next and fp-ts next in my small project decode-ts. Unfortunately I seem to be running into memory issues again (
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
).You can try it for yourself by checking out the repo, running
yarn add fp-ts@next io-ts@next
and thentsc
.It’s a small project so it should be relatively straightforward to narrow down the memory issue and file an issue against TypeScript. Until I can workaround the memory issue I won’t be able to upgrade my other project twitter-api-ts, which depends on decode-ts.
Update. After 8 days of frantic work I almost finished the rewrite, here’s the list of current breaking changes
Any comment or suggestion is welcomed
@gcanti we’re using it with io-ts, would that one need to be updated to? Otherwise, we’re mainly using those from the remaining:
Also not sure that all our libs are 2.4.1 compliant (I’ve seen angular can break with it). We’ll test as much as we can! 😃
@OliverJAsh just tried 2.4.1, the build is broken