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:
@@ -1,22 +1,18 @@
|
||||
import * as tg from "generic-type-guard";
|
||||
import { z } from "zod";
|
||||
|
||||
const isButtonDescriptor = new tg.IsInterface()
|
||||
.withProperties({
|
||||
label: tg.isString,
|
||||
className: tg.isOptional(tg.isString),
|
||||
})
|
||||
.get();
|
||||
export const isButtonDescriptor = z.object({
|
||||
label: z.string(),
|
||||
className: z.optional(z.string()),
|
||||
});
|
||||
|
||||
export const isOpenPopupEvent = new tg.IsInterface()
|
||||
.withProperties({
|
||||
popupId: tg.isNumber,
|
||||
targetObject: tg.isString,
|
||||
message: tg.isString,
|
||||
buttons: tg.isArray(isButtonDescriptor),
|
||||
})
|
||||
.get();
|
||||
export const isOpenPopupEvent = z.object({
|
||||
popupId: z.number(),
|
||||
targetObject: z.string(),
|
||||
message: z.string(),
|
||||
buttons: z.array(isButtonDescriptor),
|
||||
});
|
||||
|
||||
/**
|
||||
* A message sent from the iFrame to the game to add a message in the chat.
|
||||
*/
|
||||
export type OpenPopupEvent = tg.GuardedType<typeof isOpenPopupEvent>;
|
||||
export type OpenPopupEvent = z.infer<typeof isOpenPopupEvent>;
|
||||
|
||||
Reference in New Issue
Block a user