@tysel/types
v0.3.0
Published
Shared TypeScript types for Tysel applications and capabilities.
Downloads
668
Readme
@tysel/types
Declaration-only types for applications running on the Tysel native runtime. This package improves editor and compiler feedback; it does not polyfill Tysel APIs under Node.js.
tysel init adds the matching version automatically. For a manual installation:
version="$(tysel --version | awk '{print $2}')"
npm install --save-dev "@tysel/types@$version"Use the manifest-generated environment to narrow handlers to their declared capabilities:
import type { TyselApp } from "@tysel/types";
import type { TyselEnv } from "./tysel-env.js";
export default {
async fetch(_request, runtime) {
const rows = await runtime.sqlite.query("SELECT 1 AS value");
return Response.json({ rows });
},
} satisfies TyselApp<TyselEnv>;tysel dev synchronizes tysel-env.d.ts at startup and on reload after valid
manifest changes. Outside dev, run tysel types after changing permissions;
use tysel types --check in CI to detect stale declarations without writing files. The package exports
application, task, capability, WebSocket, and durable-execution types, including
TyselApp, RequestContext, DurableContext, and TyselRuntime. It also
declares globalThis.tysel; underscored native bindings remain private.
The package version must match the native toolchain. See the runtime API.
