| string;
props: P & { children: ComponentChildren };
key: Key;
/**
* ref is not guaranteed by React.ReactElement, for compatiblity reasons
* with popular react libs we define it as optional too
*/
ref?: Ref | null;
/**
* The time this `vnode` started rendering. Will only be set when
* the devtools are attached.
* Default value: `0`
*/
startTime?: number;
/**
* The time that the rendering of this `vnode` was completed. Will only be
* set when the devtools are attached.
* Default value: `-1`
*/
endTime?: number;
}
//
// Preact Component interface
// -----------------------------------
type Key = string | number | any;
type RefObject = { current?: T | null };
type RefCallback = (instance: T | null) => void;
type Ref = RefObject | RefCallback;
type ComponentChild =
| VNode
| object
| string
| number
| boolean
| null
| undefined;
type ComponentChildren = ComponentChild[] | ComponentChild;
interface Attributes {
key?: Key;
jsx?: boolean;
}
interface ClassAttributes extends Attributes {
ref?: Ref;
}
interface PreactDOMAttributes {
children?: ComponentChildren;
dangerouslySetInnerHTML?: {
__html: string;
};
}
type RenderableProps
= P &
Readonly }>;
type ComponentType
= ComponentClass
| FunctionComponent
;
type ComponentFactory
= ComponentType
;
type ComponentProps> = C extends ComponentType<
infer P
>
? P
: never;
interface FunctionComponent
,
previousState: Readonly,
snapshot: any
): void;
componentDidCatch?(error: any, errorInfo: any): void;
}
abstract class Component
{
constructor(props?: P, context?: any);
static displayName?: string;
static defaultProps?: any;
static contextType?: Context;
// Static members cannot reference class type parameters. This is not
// supported in TypeScript. Reusing the same type arguments from `Component`
// will lead to an impossible state where one cannot satisfy the type
// constraint under no circumstances, see #1356.In general type arguments
// seem to be a bit buggy and not supported well at the time of this
// writing with TS 3.3.3333.
static getDerivedStateFromProps?(
props: Readonly