variable / @typed/template/Render

CurrentRenderDocument

A service that provides the Document interface for rendering.

Defaults to the global document object. This can be overridden for testing or environments where the global document is not available or desired.

Package version
1.0.0-beta.13
Category
DOM document selection
Since
1.0.0

Import

import { CurrentRenderDocument } from "@typed/template/Render";

Signatures

export declare const CurrentRenderDocument: Context.Reference<Document>;

Why

DOM creation is an explicit Effect service so tests, iframes, and alternate documents can use the same renderer without patching globalThis.document.

Ownership and lifetime

The reference borrows the provided Document; it does not own or close the browsing context. The surrounding Layer controls how long the override lives.

Examples

import { CurrentRenderDocument } from "@typed/template/Render"
import { Layer } from "effect"

// Override document for testing
const testDocument = new Document()
const testLayer = Layer.succeed(CurrentRenderDocument, testDocument)

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source