TypeScript rewrite of hoist-non-react-statics with a cleaner internal structure and a Vite-based library build.
npm install @srcpush/hoist-non-react-staticsimport 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,
});- 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.
npm run build
npm run test
npm run typecheckBSD-3-Clause. See LICENSE.md.