mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor(languageSchema): enforce return type
This commit is contained in:
parent
fc5e9b2990
commit
49d815826c
1 changed files with 1 additions and 1 deletions
|
|
@ -41,7 +41,7 @@ const fileSchema = z.custom<File>((value) => value instanceof File);
|
||||||
|
|
||||||
const percentageSchema = z.coerce.number().int().gte(1).lte(100);
|
const percentageSchema = z.coerce.number().int().gte(1).lte(100);
|
||||||
|
|
||||||
const languageSchema = z.string().transform((val, ctx) => {
|
const languageSchema = z.string().transform<LanguageCode>((val, ctx) => {
|
||||||
val = (val.toLowerCase()).split('-')[0]; // pt-BR -> pt
|
val = (val.toLowerCase()).split('-')[0]; // pt-BR -> pt
|
||||||
if (!ISO6391.validate(val)) {
|
if (!ISO6391.validate(val)) {
|
||||||
ctx.addIssue({
|
ctx.addIssue({
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue