docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility for statically resolving JSX attribute values that rely on optional chaining, optional function calls, and TypeScript assertions without executing user code.
settings?.theme ?? 'light' resolves to 'light' when settings is undefined in the provided attribute node. @testsettings?.theme ?? 'light' resolves to 'dark' when settings is a literal object that includes { theme: 'dark' }. @testfactory?.().mode || 'safe' resolves to 'fast' when the optional call returns { mode: 'fast' }. @test(props!.palette as string).toUpperCase?.() resolves to 'ACCENT' when the literal palette value is 'accent'. @test/**
* Resolves a JSX attribute's value into the closest runtime-equivalent value.
* Should support optional member chains, optional calls, and TypeScript assertions/casts without throwing on unknown expressions.
*/
export function resolveAttributeValue(attribute: unknown): unknown;
/**
* Resolves only literal-friendly JSX attribute values.
* Complex expressions (including optional chains) should return undefined, null, or primitive values when they can be determined safely.
*/
export function resolveLiteralAttributeValue(attribute: unknown): string | number | boolean | null | undefined;Use utilities for interpreting JSX attribute AST nodes, including optional chaining and TypeScript assertions.