marblejs / marble

Marble.js - functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.
https://marblejs.com
MIT License
2.15k stars 73 forks source link

Latest fp-ts and io-ts do not work with event #396

Closed matthewpflueger closed 1 year ago

matthewpflueger commented 2 years ago

Describe the bug I recently attempted to upgrade fp-ts and io-ts in my project and received a ton of compiler errors for declared events:

-    "fp-ts": "2.12.1",
-    "io-ts": "2.2.16",
+    "fp-ts": "2.12.2",
+    "io-ts": "2.2.17",

An example of what for a declared event:

➤ YN0000: [@moss/domain]: lib/services/WorkspaceEvents.ts(11,56): error TS2344: Type 'EventSchema<"LOADED"> & { create: EventCreator<"LOADED">; }' does not satisfy the constraint 'Any'.
➤ YN0000: [@moss/domain]:   Types of property 'pipe' are incompatible.
➤ YN0000: [@moss/domain]:     Type '<B, IB, A extends IB, OB extends A>(this: Type<A, { type: "LOADED"; payload: undefined; }, unknown>, ab: Type<B, OB, IB>, name?: string | undefined) => Type<B, { type: "LOADED"; payload: undefined; }, unknown>' is not assignable to type '<B, IB, A extends IB, OB extends A>(this: Type<A, any, any>, ab: Type<B, OB, IB>, name?: string | undefined) => Type<B, any, any>'.
➤ YN0000: [@moss/domain]:       The 'this' types of each signature are incompatible.
➤ YN0000: [@moss/domain]:         Type 'Type<A, any, any>' is not assignable to type 'Type<IB, { type: "LOADED"; payload: undefined; }, unknown>'.
➤ YN0000: [@moss/domain]:           Types of property 'is' are incompatible.
➤ YN0000: [@moss/domain]:             Type 'Is<A>' is not assignable to type 'Is<IB>'.

The event was declared like:

export const WorkspaceLoadedEvent = event(WorkspaceEventTypes.LOADED)(t.type({ name: t.string })

To Reproduce Try upgrading fp-ts and io-ts

Expected behavior No compiler errors

Desktop (please complete the following information):

Additional context Usage of fp-ts and io-ts outside of event did not throw compiler errors.

matthewpflueger commented 1 year ago

Hi @JozefFlakus is this a legitimate concern? I ask because I haven't been able to upgrade fp-ts or io-ts due to the compiler error in marblejs...

matthewpflueger commented 1 year ago

@JozefFlakus When do you think a release will get cut?

JozefFlakus commented 1 year ago

@matthewpflueger relased ✅. Sorry that you had to wait.