Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

SocketSchema

interfaz

Subconjunto de Standard Schema v1 que valida los payloads de un evento Socket, como los schemas de Valibot de shared/schemas.

ts
import type { SocketSchema } from "@meekojs/meeko/framework";

Source code src/app/runtime/socket.ts:24

Declaración #

ts
interface SocketSchema<I = unknown, O = I> {
	readonly '~standard': {
		readonly version: 1
		readonly validate: (value: unknown) => { value: O; issues?: undefined } | { issues: readonly unknown[] } | Promise<{ value: O; issues?: undefined } | { issues: readonly unknown[] }>
		readonly types?: { readonly input: I; readonly output: O } | undefined
	}
}

Type parameters #

I = unknown

Tipo de entrada.

O = I

Tipo de salida.

Example #

ts
import * as v from "valibot";
import type { SocketSchema } from "@meekojs/meeko/framework";

const chatMessage: SocketSchema<{ text: string }> = v.object({ text: v.string() });

Propiedades #

~standard #

propiedad sólo lectura

readonly '~standard': {
	readonly version: 1
	readonly validate: (value: unknown) => { value: O; issues?: undefined } | { issues: readonly unknown[] } | Promise<{ value: O; issues?: undefined } | { issues: readonly unknown[] }>
	readonly types?: { readonly input: I; readonly output: O } | undefined
}

Interfaz Standard Schema v1: validate devuelve el valor de salida o la lista de issues.

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/app/runtime/socket.ts