diff --git a/src/Injector.ts b/src/Injector.ts index 081d4c7f..2fa6e52a 100644 --- a/src/Injector.ts +++ b/src/Injector.ts @@ -73,10 +73,21 @@ export interface InjectorProperties extends WidgetProperties { children: DNode[]; } -export class BaseInjector extends WidgetBase { +export interface Base { + toInject(): C; +} + +export class Base extends WidgetBase implements Base { protected context: C = {}; + public toInject(): C { + return this.context; + } +} + +export class BaseInjector extends Base { + constructor(context?: C) { super(); if (context) { @@ -85,16 +96,13 @@ export class BaseInjector extends WidgetBase>>(Base: T, context: C): T { +export function Injector>>(Base: T, context: C): T { @diffProperty('render', always) class Injector extends Base {