Question on Type Narrowing in TypeScript
Can someon explain me why this is not narrowed to an array of BroadcastSchema ??
Where the schema is defined as:
Where the schema is defined as:
import * as A from "effect/Array";
function foo(){
return pipe(
$events,
A.filter((i) => BroadcastSchema.is(i)),
);
}export class BroadcastSchema extends S.Class<BroadcastSchema>("Broadcast")(
{ type: S.Literal("fireworks", "confetti", "vivan los novios") },
) {
static decode = S.decodeEither(this);
static encode = S.encode(this);
static make(fields: ConstructorParameters<typeof BroadcastSchema>[0]) {
return new BroadcastSchema(fields);
}
static is = S.is(this);
static Payload = this;
}