CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-hoist-non-react-statics

Copies non-react specific statics from a child component to a parent component

95

1.09x
Overview
Eval results
Files

task.mdevals/scenario-1/

Component Wrapper Static Control

A utility that wraps a React component while mirroring its custom static properties to the wrapper, allowing callers to block selected statics through an exclusion map. The exclusion map uses string or symbol keys set to truthy values to indicate which statics should be skipped while copying all others.

Capabilities

Respects exclusion map

  • When the source component defines statics (e.g., role, version) and the exclusion map flags role, the wrapped component exposes version but not role. @test
  • When the exclusion map is omitted or empty, all non-React statics from the source become available on the wrapper. @test

Supports symbol statics

  • A symbol-keyed static excluded by the map is not copied, while other symbol statics are hoisted to the wrapper. @test

Preserves target-defined statics

  • If the wrapper already defines a static, wrapping keeps the existing value while hoisting other non-excluded statics from the source. @test

Implementation

@generates

API

export function wrapWithStaticControl(targetComponent, sourceComponent, exclusionMap?: Record<string | symbol, boolean>): typeof targetComponent;

Dependencies { .dependencies }

hoist-non-react-statics { .dependency }

Hoists custom static properties between components while honoring React-reserved keys and caller-specified exclusion maps.

Install with Tessl CLI

npx tessl i tessl/npm-hoist-non-react-statics

tile.json