effect
effect copied to clipboard
Schema's TemplateLiteral with NonEmptyString
What is the problem this feature would solve?
Assume we have the following schema
const User = Schema.Struct({
id: Schema.TemplateLiteral("user_", Schema.String),
})
But what is desirable is instead
const User = Schema.Struct({
id: Schema.TemplateLiteral("user_", Schema.NonEmptyString),
})
What is the feature you are proposing to solve the problem?
Is there a particular reason why NonEmptyString doesn't work with TemplateLiteral?
Otherwise, this would be an easy task for me to start contributing.
What alternatives have you considered?
A workaround I just thought of, but haven't tried yet, would be:
const User = Schema.Struct({
id: Schema.TemplateLiteral("user_", Schema.String.pipe(Schema.minLength(1)),
})