Askr documentation
Generated API snapshot

@askrjs/askr

Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.

Exports

This entrypoint publishes 26 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

configureRenderDiagnosticstype

configureRenderDiagnostics: (options: RenderDiagnosticsOptions) => () => void

Configure development render diagnostics and return a function that restores the previous configuration. Component counters and timing remain enabled when warning output is disabled.

createElementtype

createElement: (type: string | symbol | ((props: never) => unknown), props: Record<string, unknown> | null, ...children: unknown[]) => JSXElement

Classic element factory. The automatic JSX transform falls back to it for a key written after a spread (<Row {...props} key={id} />). The key and the development-only __self/__source props are taken out of props, and child arguments become props.children.

createReftype

createRef: <T extends Element = Element>() => Ref<T>

Create a new, empty {@link Ref} holder.

cspNoncetype

cspNonce: () => string | undefined

Read the CSP nonce for the current render from {@link CspNonceScope}.

CspNonceScopetype

CspNonceScope: Scope<string | undefined>

Lexical scope carrying the CSP nonce for the current render, if any.

defineScopetype

defineScope: <T>(defaultValue: T) => Scope<T>

Create a new lexical {@link Scope} with defaultValue, readable via {@link readScope}.

derivetype

derive: { <TOut>(fn: () => TOut): Derived<TOut>; <TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>; }

Creates a render-scoped derived value; must be called during component render.

Derivedtype

Derived: any

A reactive derived value produced by {@link derive}; call it to read the current result.

Fragmenttype

Fragment: typeof Fragment

The element type marker for JSX fragments (<>...</>), groups children without a wrapper element.

getSignaltype

getSignal: () => AbortSignal

Get the abort signal for the current component. The signal is guaranteed to be aborted when: - Component unmounts - Navigation occurs (different route) - Parent is destroyed

jsxtype

jsx: { <TTag extends keyof KnownIntrinsicElementProps>(type: TTag, props: KnownIntrinsicElementProps[NoInfer<TTag>] | null, key?: string | number): JSXElement; <TTag extends OtherIntrinsicTag>(type: TTag, props: OtherIntrinsicProps<TTag> | null, key?: string | number): JSXElement; <TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number): JSXElement; (type: symbol, props: Props | null, key?: string | number): JSXElement; }

JSX factory for elements with a single or no child, used by the jsxImportSource transform.

jsxstype

jsxs: { <TTag extends keyof KnownIntrinsicElementProps>(type: TTag, props: KnownIntrinsicElementProps[NoInfer<TTag>] | null, key?: string | number): JSXElement; <TTag extends OtherIntrinsicTag>(type: TTag, props: OtherIntrinsicProps<TTag> | null, key?: string | number): JSXElement; <TProps extends object>(type: (props: TProps) => unknown, props: TProps | null, key?: string | number): JSXElement; (type: symbol, props: Props | null, key?: string | number): JSXElement; }

JSX factory for elements with multiple static children, used by the jsxImportSource transform.

Propstype

Props: any

Props accepted by components and elements. Intentionally permissive but provides a single named type.

children
Optional children slot
key
Optional key for keyed lists (string | number | symbol for internal frames)

readScopetype

readScope: <T>(context: Scope<T>) => T

Read the current value of a {@link Scope} during component render or an async resource.

Reftype

Ref: any

Creates a stable holder for an intrinsic element ref. The renderer mutates current during commit and clears it during cleanup. Updating the holder never schedules a render.

current
current: T | null;

registerSSRStyletype

registerSSRStyle: (id: string, cssText: string) => void

Register request-local CSS produced during SSR without importing the SSR renderer in clients.

RenderableChildtype

RenderableChild: VNode | JSXElement | readonly RenderableChild[]

RenderDepthErrortype

RenderDepthError: typeof RenderDepthError

Thrown when the JavaScript call stack overflows during a render, usually because the component tree is too deep. cause is the engine's error.

cause
readonly cause: unknown;

RenderDiagnosticsOptionstype

RenderDiagnosticsOptions: any

Options for {@link configureRenderDiagnostics}.

slowRenderWarnings
Emit one warning per component instance when a render exceeds the threshold.
slowRenderThresholdMs
Slow-render threshold in milliseconds. The default is 5.

Scopetype

Scope: any

A lexical scope created by {@link defineScope}; render it as a provider component, read it with {@link readScope}.

key
readonly key: ContextKey;
defaultValue
readonly defaultValue: T;

selectortype

selector: <T>(source: () => T, equals?: SelectorEquals<T>) => Selector<T>

Creates a render-scoped predicate for keyed membership in reactive list rows. Use this when a <For> child needs to compare each stable item with a changing selected value. Unlike a plain closure capture, the predicate subscribes the affected rows and updates them without rebuilding the list. Must be called during component render.

Selectortype

Selector: any

A fine-grained reactive membership check produced by {@link selector}.

statetype

state: <T>(initialValue: T) => StateTuple<T>

Creates a local state value for a component Optimized for: - O(1) read performance - Minimal allocation per state - Fast scheduler integration IMPORTANT: state() must be called during component render execution. It captures the current component instance from context. Calling outside a component function will throw an error.

```ts
// ✅ Correct: called during render
export function Counter() {
  const [count, setCount] = state(0);
  return { type: 'button', children: [count()] };
}

// ❌ Wrong: called outside component
const count = state(0);
export function BadComponent() {
  return { type: 'div' };
}
```

Statetype

State: any

State value holder - callable to read, has set method to update

const count = state(0);
count();           // read: 0
count.set(1);      // write: triggers re-render
set
set(...args: StateSetterArgs<T>): void;

StateSettertype

StateSetter: (...args: StateSetterArgs<T>) => void

Public setter type for state cells.

StateTupletype

StateTuple: [get: State<T>, set: StateSetter<T>] & State<T>

Tuple-first state handle returned by state().