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.

JsonShape

tipo Since 1.1.0

Forma serializable en JSON de T. Un miembro que no puede llegar al cliente (funciones, undefined, bigint, símbolos o instancias de clase) se convierte en una cadena que lo explica, de modo que el error de tipos señala el campo.

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

Source code src/server/runtime/page-body.ts:64

Declaración #

ts
type JsonShape<T> = T extends string | number | boolean | null ? T : T extends Deferred<infer U> ? Deferred<JsonShape<U>> : T extends undefined | bigint | symbol | ((...args: never[]) => unknown) ? NotJson : T extends readonly unknown[] ? { [K in keyof T]: JsonShape<T[K]> } : T extends object ? { [K in keyof T]: JsonShape<T[K]> } : NotJson

Type parameters #

T

Tipo que se va a enviar al cliente.

Example #

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

type Shape = JsonShape<{ id: string; load: () => void }>;
// Shape["load"] es la cadena "not serializable to JSON: ...".
const ok: JsonShape<{ id: string }> = { id: "1" };

See also #

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/server/runtime/page-body.ts