Skip to content

srcpush/hoist-non-react-statics

 
 

Repository files navigation

@srcpush/hoist-non-react-statics

TypeScript rewrite of hoist-non-react-statics with a cleaner internal structure and a Vite-based library build.

Install

npm install @srcpush/hoist-non-react-statics

Usage

import hoistNonReactStatics from '@srcpush/hoist-non-react-statics';

const Enhanced = hoistNonReactStatics(targetComponent, sourceComponent);

To skip specific statics, pass an exclude list:

hoistNonReactStatics(targetComponent, sourceComponent, {
  myStatic: true,
  myOtherStatic: true,
});

What Changed

  • Rewritten in TypeScript with typed exports.
  • Internal logic split into focused modules instead of a single file.
  • Vite library build emits both ESM and CommonJS bundles.
  • Vitest coverage keeps the original hoisting behavior around forwardRef, memo, accessors, symbols, and inherited statics.

Scripts

npm run build
npm run test
npm run typecheck

License

BSD-3-Clause. See LICENSE.md.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • TypeScript 100.0%