Using Effect.Schema to Define Default Options for Strings and Other Types

Heya~ Not sure I understand how to use Effect.Schema to define default options for simple things like strings...

This is what I got right now:
import { Schema } from "effect"


const value = <TSchema extends Schema.Schema.Any>(config: {
  schema: TSchema;
}) => {};

value({
  schema: Schema.Trim.pipe(Schema.propertySignature, Schema.withConstructorDefault(() => '')),
});

However, Typescript can't cast the schema to a proper Schema.Schema<string>, since it's a PropertySignature? How can I build a helper that allows any kind of Effect schema (so that i can use it for later?)

And is there an easy way to determine the default value of a schema?

Thanks in advance!
Was this page helpful?