fix(core): event codec - missing io-ts types
MODIFY
packages/core/src/event/event.spec.ts
packages/core/src/event/event.spec.ts
@@ -104,6 +104,26 @@ describe('#event', () => {
})
});
+ test('creates event schema with intersection and partial payload', () => {
+ const Foo = event('FOO')(t.intersection([
+ t.partial({
+ test_partial: t.string
+ }),
+ t.type({
+ test_required: t.string,
+ }),
+ ]));
+
+ const foo = Foo.create({
+ test_required: 'test'
+ });
+
+ expect(foo).toEqual({
+ type: 'FOO',
+ payload: { test_required: 'test' },
+ })
+ });
+
test('successfuly decodes event schema with object payload and metadata', () => {
const Foo = event('FOO')(t.type({
bar: t.string,

MODIFY
packages/core/src/event/event.ts
packages/core/src/event/event.ts
@@ -4,12 +4,28 @@ import { Event, EventWithPayload, EventWithoutPayload } from './event.interface'
type Payload =
| t.TypeC<any>
| t.TupleC<any>
+ | t.TaggedUnionC<any, any>
+ | t.ReadonlyC<any>
| t.ReadonlyArrayC<any>
+ | t.AnyC
| t.ArrayC<any>
| t.StringC
+ | t.BigIntC
| t.BooleanC
+ | t.BrandC<any, any>
| t.NumberC
+ | t.NullC
+ | t.UnionC<any>
| t.UndefinedC
+ | t.PartialC<any>
+ | t.RefinementC<any>
+ | t.RecordC<any, any>
+ | t.IntersectionC<any>
+ | t.ExactC<any>
+ | t.ObjectC
+ | t.StringC
+ | t.LiteralC<any>
+ | t.KeyofC<any>
;
export type EventSchema<T extends string> =

fix(core): event codec - missing io-ts types