docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Builds a helper that inspects a JSX opening element node and returns a plain object of props whose values are purely literal.
<Button label="Click" size={12} disabled>, returns { label: "Click", size: 12, disabled: true } with keys matching attribute names. @testnull or undefined, include it as the value rather than omitting. Example <Item note={null} flag={undefined}> yields { note: null, flag: undefined }. @test<Card onSelect={() => pick()} title="View" data={user}> only include the literal entries, resulting in { title: "View" }, and skip props whose values are functions, identifiers, JSX elements, or other expressions. @test<List values={["a", 2, otherVar, () => 3, false]} tag="ok"> include only the literal array items, resulting in { values: ["a", 2, false], tag: "ok" }. @test<List values={[handler, ref]}>), omit that prop from the output entirely. @testexport function extractLiteralProps(openingElementNode);Accepts a JSXOpeningElement AST node and returns a plain object mapping attribute names (including namespaces and hyphenated names) to their literal values. Boolean-style attributes without an explicit value must be treated as true. Props with non-literal values are skipped unless an array contains at least one literal entry, in which case only the literal elements are preserved. Props omitted due to non-literal or empty literal results must not appear as keys in the returned object.
Utilities for inspecting JSX AST nodes to read prop names and literal-safe values. @satisfied-by