Browse API packages

API · v0.3.0

symbol

Shared interoperability symbols

Member signatures use schematic object.member(...) API notation. Exported type declarations are valid TypeScript.

Shared symbols for interoperable JavaScript protocols.

Every symbol uses JavaScript's global symbol registry, so separately loaded copies of the package use identical protocol keys in Node, Deno, Bun, and browsers.

ts
import symbol from "@rcompat/symbol";

symbol.parse#

Identifies an object that can produce a plain representation through [symbol.parse]().

Registered globally as Symbol.for("std:symbol/parse"). Consumers can invoke the protocol instead of requiring a plain object.

ts
symbol.parse: unique symbol;

symbol.stream#

Identifies an object that can provide a ReadableStream through [symbol.stream]().

Registered globally as Symbol.for("std:symbol/stream"). FileRef implements this protocol for file streams.

ts
symbol.stream: unique symbol;