From 28424b63cb0d59b697ee14873f216a9dbfd75107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 24 Feb 2025 13:47:29 +0100 Subject: [PATCH] Working extension --- packages/reffuse/src/ReffuseExtension.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/reffuse/src/ReffuseExtension.ts b/packages/reffuse/src/ReffuseExtension.ts index 2160bf9..4e16d61 100644 --- a/packages/reffuse/src/ReffuseExtension.ts +++ b/packages/reffuse/src/ReffuseExtension.ts @@ -24,7 +24,8 @@ const make = (extension: Ext) => StaticType ) => { const class_ = class extends self {} - return class_ + class_.prototype = { ...class_.prototype, ...extension } as any + return class_ as any } export const withContexts = >( @@ -55,10 +56,14 @@ const withMyContext = withContexts(MyContext) const clsWithMyContext = withMyContext(Reffuse) class ReffuseWithMyContext extends clsWithMyContext {} -const t = new ReffuseWithMyContext() -const cls1 = make({ +const withProut = make({ prout(this: ReffuseHelpers.ReffuseHelpers) {} -})(Reffuse) +}) -class Cls1 extends cls1 {} +class MyReffuse extends Reffuse.pipe( + withProut, + withContexts(MyContext), +) {} + +new MyReffuse().useFork()