marble
marble copied to clipboard
Latest fp-ts and io-ts do not work with event
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):
- OS: macOS Monterey Version 12.5
- Package + Version: @marblejs/core 4.0.3
- Node version: v16.15.0
Additional context Usage of fp-ts and io-ts outside of event did not throw compiler errors.