Handling generics in Context.Tag for dynamic permissions
effect
Hi all, I've only recently dived into the fantastic world of Effect. I was studying Lucas Barake's great content, specifically https://lucas-barake.github.io/building-a-composable-policy-system/. I decided to create a policy system that is as generic as possible. The problem arises here:
export type PermissionAction = "read" | "manage" | "delete"; export type PermissionConfig = Record<string, ReadonlyArray<PermissionAction>>;
export type InferPermissions<T extends PermissionConfig> = { [K in keyof T]: T[K][number] extends PermissionAction ?
In this case, permissions are defined using the Permission type, but I need to make everything generic to ensure the code is reusable. I understand—correct me if I'm wrong—that it's not possible to use generics directly with Context.Tag. How can I achieve this?