UNPKG

@sprucelabs/schema

Version:

Static and dynamic binding plus runtime validation and transformation to ensure your app is sound. 🤓

7 lines (6 loc) • 495 B
import DynamicSchemaEntityImplementation from '../DynamicSchemaEntityImplementation'; import { Schema, IsDynamicSchema, SchemaPartialValues } from '../schemas.static.types'; import StaticSchemaEntity from '../StaticSchemaEntityImpl'; export default class SchemaEntityFactory { static Entity<S extends Schema, IsDynamic extends boolean = IsDynamicSchema<S>>(schema: S, values?: SchemaPartialValues<S>): IsDynamic extends true ? DynamicSchemaEntityImplementation<S> : StaticSchemaEntity<S>; }