Effect CommunityEC
Effect Communityβ€’2w agoβ€’
4 replies
Brave Sir Robin

Narrowing Types in a Discriminated Union with Effect.filter

const filteredBlocks = yield* Effect.filter(blocks, (block: typeof confectSchema.tableSchemas.profile_blocks.withSystemFields.Type) => Effect.succeed(
  block.kind === "experience"
))


I feel like I'm going crazy with this. I've got a discriminated union and I want to extract blocks of a specific kind and get a subset of that array. However the types are not being narrowed properly. How can I approach this?
Was this page helpful?