refactor: replace zod with shapeshift (#7547)

This commit is contained in:
Parbez
2022-04-09 15:07:16 +05:30
committed by GitHub
parent 3f3e4327c8
commit 3c0bbac82f
14 changed files with 105 additions and 116 deletions

View File

@@ -1,16 +1,15 @@
import { z } from 'zod';
import { s } from '@sapphire/shapeshift';
import { ApplicationCommandType } from 'discord-api-types/v10';
import type { ContextMenuCommandType } from './ContextMenuCommandBuilder';
const namePredicate = z
.string()
.min(1)
.max(32)
const namePredicate = s.string
.lengthGe(1)
.lengthLe(32)
.regex(/^( *[\p{L}\p{N}_-]+ *)+$/u);
const typePredicate = z.union([z.literal(ApplicationCommandType.User), z.literal(ApplicationCommandType.Message)]);
const typePredicate = s.union(s.literal(ApplicationCommandType.User), s.literal(ApplicationCommandType.Message));
const booleanPredicate = z.boolean();
const booleanPredicate = s.boolean;
export function validateDefaultPermission(value: unknown): asserts value is boolean {
booleanPredicate.parse(value);