Checking if a Schema is Encodable to Strings in Effect Typescript
how can I check if Schema is encodeable to strings or not ?
//my id Schema
export const Id = Schema.Union(Schema.Number,Schema.NumberFromString)
.pipe(Schema.brand("DatabaseID"));
//using that id
const MyApi = HttpApi.make("MyApi").add(
HttpApiGroup.make("users")
.add(
HttpApiEndpoint.get("list")`/list`.addSuccess(Schema.Array(User))
)
.add(
HttpApiEndpoint.get("by_id")`/:id`
.setPath(
Schema.Struct({
id: Id // <============= why I can't use Id Schema
})
)
.addSuccess(User)
)
)//my id Schema
export const Id = Schema.Union(Schema.Number,Schema.NumberFromString)
.pipe(Schema.brand("DatabaseID"));
//using that id
const MyApi = HttpApi.make("MyApi").add(
HttpApiGroup.make("users")
.add(
HttpApiEndpoint.get("list")`/list`.addSuccess(Schema.Array(User))
)
.add(
HttpApiEndpoint.get("by_id")`/:id`
.setPath(
Schema.Struct({
id: Id // <============= why I can't use Id Schema
})
)
.addSuccess(User)
)
)