import * as React from "react"; import {ReactElement} from "react"; import {GlobalContext, GlobalContextContent} from "../react/global-context"; export interface StatefulBaseComponentConstructor
extends React.ComponentClass
, React.ComponentLifecycle
{ new (props?: P, context?: any): StatefulBaseComponent
; } /* do not use this, without special problem */ export abstract class StatefulBaseComponent
extends React.Component
implements GlobalContext {
public readonly context: any;
private static _bindingMethods; // not used any where
public abstract state: S;
constructor(props: P, context) {
super(props, context);
// console.log('constructor of', this.constructor.name);
if (this.constructor.hasOwnProperty('_bindingMethods')) {
this.constructor['_bindingMethods'].forEach((name) => {
this[name] = this[name].bind(this);
});
}
this.afterConstruct(props, context);
}
afterConstruct extends React.ComponentClass , React.ComponentLifecycle {
new (props?: P, context?: any): BaseComponent ;
}
export interface ReactComponentConstructor extends React.ComponentClass , React.ComponentLifecycle {
new (props?: P, context?: any): React.Component ;
}
/** Redux base component */
export abstract class BaseComponent extends StatefulBaseComponent implements GlobalContext {
state: {};
}
export function BindThis