Skip to content

waygraph / reads

Function: reads() ​

reads(namespace): <T>() => ReadNamespace<T>

Defined in: src/engine/read/read-key.ts:52

Declares a read namespace: one type, its property names become key paths, no const per key.

Parameters ​

namespace ​

string

Returns ​

<T>() => ReadNamespace<T>

Example ​

ts
export const Post = reads("post")<{ title: string; likes: number; comments: { author: string; body: string }[] }>();
Post.likes;                                 // ReadKey<number>, path "post.likes"
Post({ title: ctx.page.text("h1") });            // the spec a Read Block returns

Deprecated ​

A page's read declares its keys as it reads: definePageBlock({ read: (ctx) => ({ title: ctx.page.text("h1") }) }), then Page.read.title. waygraph upgrade --codemod page-object moves a project.

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed