Schemas
TYPE
@skmtc/core 0.63.4SchemaToValueFn
Function type for transforming schemas to type system values.
Signature
import type { SchemaToValueFn } from '@skmtc/core'
type SchemaToValueFn = <Schema extends SchemaType>(args: TypeSystemArgs<Schema>) => TypeSystemOutput<Schema['type']>Schema
The schema type being transformed
Examples
Example
const transformSchema: SchemaToValueFn = (args) => {
switch (args.schema.type) {
case 'string':
return transformStringSchema(args);
case 'object':
return transformObjectSchema(args);
// ... other cases
default:
throw new Error(`Unknown schema type: ${args.schema.type}`);
}
};