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
+14 -18
View File
@@ -1,24 +1,20 @@
import * as tg from "generic-type-guard";
import { z } from "zod";
export const isOpenCoWebsiteEvent = new tg.IsInterface()
.withProperties({
url: tg.isString,
allowApi: tg.isOptional(tg.isBoolean),
allowPolicy: tg.isOptional(tg.isString),
widthPercent: tg.isOptional(tg.isNumber),
position: tg.isOptional(tg.isNumber),
closable: tg.isOptional(tg.isBoolean),
lazy: tg.isOptional(tg.isBoolean),
})
.get();
export const isOpenCoWebsiteEvent = z.object({
url: z.string(),
allowApi: z.optional(z.boolean()),
allowPolicy: z.optional(z.string()),
widthPercent: z.optional(z.number()),
position: z.optional(z.number()),
closable: z.optional(z.boolean()),
lazy: z.optional(z.boolean()),
});
export const isCoWebsite = new tg.IsInterface()
.withProperties({
id: tg.isString,
})
.get();
export const isCoWebsite = z.object({
id: z.string(),
});
/**
* A message sent from the iFrame to the game to add a message in the chat.
*/
export type OpenCoWebsiteEvent = tg.GuardedType<typeof isOpenCoWebsiteEvent>;
export type OpenCoWebsiteEvent = z.infer<typeof isOpenCoWebsiteEvent>;