Limitations of `S.TemplateLiteral` Schema Support and the Case for Broader Transform Compatibility
Why does
For example,
So given all that, why not make
S.TemplateLiteral have a special whitelisted list of schemas that it supports? It limits the ability to apply transforms to the templated data. For example,
S.Number is seemingly whitelisted & special cased to work within S.TemplateLiteral, where the more ergonomic and intuitive choice (IMHO) would be S.NumberFromString. And even if we hard-code support for other common transforms such as DateFromString, BooleanFromString etc into S.TemplateLiteral, that still doesn't help with user-land transforms.So given all that, why not make
S.TemplateLiteral support any schemas whose encoded side is string (or inherits from string so we support literals/unions)?