UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

18 lines (16 loc) 380 B
import {type SchemaType} from '@sanity/types' export function getEmptyValue(type: SchemaType): number | string | boolean { switch (type.jsonType) { case 'string': { return '' } case 'number': { return -0 } case 'boolean': { return false } default: throw new Error(`Unable to create value from type "${type.jsonType}"`) } }