1 | import * as React from 'react';
|
2 | import { BrowserRouterProps } from 'react-router-dom';
|
3 |
|
4 | declare module 'hops' {
|
5 | type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
6 |
|
7 | export class Miss extends React.Component {}
|
8 |
|
9 | export interface StatusProps {
|
10 | code: number;
|
11 | }
|
12 | export class Status extends React.Component<StatusProps> {}
|
13 |
|
14 | export interface HeaderProps {
|
15 | name: string;
|
16 | value: string;
|
17 | }
|
18 |
|
19 | export class Header extends React.Component<HeaderProps> {}
|
20 |
|
21 | export interface ImportComponentRenderOptions<Props> {
|
22 | Component: React.ComponentType<Props>;
|
23 | error: boolean;
|
24 | loading: boolean;
|
25 | }
|
26 |
|
27 | export interface ImportComponentOptions<Props> {
|
28 | loader?: (load: Promise<any>) => Promise<any>;
|
29 | render?: (
|
30 | options: ImportComponentRenderOptions<Props> & Props
|
31 | ) => React.ReactNode;
|
32 | }
|
33 |
|
34 | export function importComponent<Props>(
|
35 | load: () => Promise<{ default: React.ComponentType<Props> }>
|
36 | ): React.ComponentType<ImportComponentOptions<Props> & Props>;
|
37 |
|
38 | export function importComponent<Props, Exports>(
|
39 | load: () => Promise<Exports>,
|
40 | resolver: (exports: Exports) => React.ComponentType<Props>
|
41 | ): React.ComponentType<ImportComponentOptions<Props> & Props>;
|
42 |
|
43 | export function importComponent<Props>(
|
44 | module: string,
|
45 | exportName?: string
|
46 | ): React.ComponentType<ImportComponentOptions<Props>>;
|
47 |
|
48 | export interface ServerData {
|
49 | [key: string]: any;
|
50 | }
|
51 |
|
52 | export interface Config {
|
53 | [key: string]: any;
|
54 | }
|
55 |
|
56 | export const ServerDataContext: React.Context<ServerData>;
|
57 |
|
58 | export const ConfigContext: React.Context<Config>;
|
59 |
|
60 | export function withServerData<
|
61 | P extends { serverData: C },
|
62 | C = ServerData,
|
63 | R = Omit<P, 'serverData'>
|
64 | >(Component: React.ComponentType<P>): React.ComponentType<R>;
|
65 |
|
66 | export function withConfig<
|
67 | P extends { config: C },
|
68 | C = Config,
|
69 | R = Omit<P, 'config'>
|
70 | >(Component: React.ComponentType<P>): React.ComponentType<R>;
|
71 |
|
72 | export class Mixin {}
|
73 |
|
74 | export const strategies: any;
|
75 |
|
76 | export interface HopsOptions {
|
77 | router?: BrowserRouterProps;
|
78 | }
|
79 |
|
80 | export function render<Options = { [key: string]: any }, P = {}>(
|
81 | reactElement: React.ReactElement<P>,
|
82 | options?: Options & HopsOptions
|
83 | ): void;
|
84 | }
|