Extracting Schema-Defined Properties from TaggedError in TypeScript
If I have a shema like this:
class Bar extends Schema.TaggedError<Bar>()("Bar", { bar: Schema.String,}) {}
class Bar extends Schema.TaggedError<Bar>()("Bar", { bar: Schema.String,}) {}
Is there a way for me to only get the properties and values as defined by the schema in the error? Without also getting name, cause, stack, etc.
We use tRPC with superjson, but I would like to return a union result type from our trpc mutations, where the error properties also get passed to the client, but serialized by superjson since we can't easily migrate to Effect RPC or something. Hope this makes sense