2
0
Files
bot/packages/models/features/utils.ts

16 lines
353 B
TypeScript
Raw Normal View History

2022-11-29 10:02:40 +01:00
import { z } from 'zod'
export type IdMap<T> = { [id: string]: T }
2022-11-29 10:02:40 +01:00
export const schemaForType =
<T>() =>
<S extends z.ZodType<T, any, any>>(arg: S) => {
return arg
}
export const variableStringSchema = z.custom<`{{${string}}}`>((val) =>
/^{{.+}}$/g.test(val as string)
)
export type VariableString = z.infer<typeof variableStringSchema>