Zod EVERYWHERE (#2027)

* Zod EVERYWHERE

* Add no-unused-vars rule to eslint in front

* Add no-unused-vars rule to eslint in pusher

* Add no-unused-vars rule to eslint in back

* Remove unused PlayerTexture guards

* Fix data providing on room connection

Co-authored-by: Alexis Faizeau <a.faizeau@workadventu.re>
This commit is contained in:
Alexis Faizeau
2022-04-12 14:21:19 +02:00
committed by GitHub
parent 41e62051d4
commit d1e8243c47
161 changed files with 1131 additions and 1248 deletions
+12 -16
View File
@@ -1,22 +1,18 @@
import * as tg from "generic-type-guard";
//import { isCharacterTexture } from "./CharacterTexture";
import { z } from "zod";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
export const isRegisterData = new tg.IsInterface()
.withProperties({
roomUrl: tg.isString,
email: tg.isNullable(tg.isString),
organizationMemberToken: tg.isNullable(tg.isString),
mapUrlStart: tg.isString,
userUuid: tg.isString,
authToken: tg.isString,
})
.withOptionalProperties({
messages: tg.isArray(tg.isUnknown),
})
.get();
export type RegisterData = tg.GuardedType<typeof isRegisterData>;
export const isRegisterData = z.object({
roomUrl: z.string(),
email: z.nullable(z.string()),
organizationMemberToken: z.nullable(z.string()),
mapUrlStart: z.string(),
userUuid: z.string(),
authToken: z.string(),
messages: z.optional(z.array(z.unknown())),
});
export type RegisterData = z.infer<typeof isRegisterData>;