Effect CommunityEC
Effect Community2y ago
3 replies
Jherlevsen

Creating a Generic Function with Schema Validation in TypeScript

Hello 🙂

I am trying to create a generic function that takes:
- some unknown data
- a schema that should be a record/object
- a key (string), that should be on the schema, and the value of that key in the schema should be unknown[]

I have created 2 functions on playground https://effect.website/play#8c6df45f44fc. The first one is a generic function, that is kind of what I want, just without the schema. The second function is as far as I can get myself with the schema version.

Is it possible to do what I want?
Was this page helpful?