@prismicio/types-internal
Version:
Prismic types for Custom Types and Prismic Data
14 lines (9 loc) • 302 B
text/typescript
import * as t from "io-ts"
import { refineType } from "../validators/function"
const widgetKeyRegex = new RegExp("^[^<>]+$")
export const WidgetKey = refineType(
t.string,
"WidgetKey",
(s: string) => s.length === 0 || widgetKeyRegex.test(s),
)
export type WidgetKey = t.TypeOf<typeof WidgetKey>