Effect CommunityEC
Effect Community3y ago
34 replies
ignorethecrane

Working with Incompatible JSON schema in TypeScript: Transforming and Applying Parameter Schemas

(Rephrasing yesterday's question in the hope of eliciting some help): Say I have some json that i want to work with in a typescript codebase but the json has a schema that cannot be represented in typescript, e.g. type T = { type: "foo"; [key: string]: { _type: "bar" } }. Is my best bet to transformOrFail from S.unknown into whatever desired internal, typescript-compatible type I have, applying the individual parameter schemas by hand within the transformation function?
Was this page helpful?