1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
import * as React from 'react';
interface ErrorReporterProps {
error: any;
}
export interface AppContainerProps {
errorBoundary?: boolean;
errorReporter?: React.ComponentType<ErrorReporterProps>;
}
export interface AppChildren {
children?: React.ReactElement<any>;
}
export class AppContainer extends React.Component<AppContainerProps & AppChildren> {}
/**
* Marks module and a returns a HOC to mark a Component inside it as hot-exported
* @param {NodeModuleObject} module ALWAYS should be just "module".
* @return {function} "hot" HOC.
*
* @example marks current module as hot, and export MyComponent as HotExportedMyComponent
* export default hot(module)(MyComponent)
*/
export function hot(module: any): <T = React.ComponentType<any>>(Component: T, props?: AppContainerProps) => T;
/**
* Marks component as `cold`, and making it invisible for React-Hot-Loader.
* Any changes to that component will cause local state loss.
* @param {React.ComponentType} component to chill
* @return {React.ComponentType} component, as it was passed in.
*
* @example marks some component as cold
* export default cold(MyComponent)
*/
export function cold<T = React.ComponentType<any>>(component: T): T;
/**
* Tests are types of two components equal
* @param {Component} typeA
* @param {Component} typeB
* @return {boolean} are they equal
*
* @example test that some rendered component(ReactElement), has the same type as BaseComponent
* areComponentEqual(RenderedComponent.type, BaseComponent)
*/
export function areComponentsEqual<T>(typeA: React.ComponentType<T>, typeB: React.ComponentType<T>): boolean;
export interface HotError {
error: Error;
errorInfo?: React.ErrorInfo;
}
export interface Config {
/**
* Specify loglLevel, default to 'error', set it to false to disable logs.
* Available levels: ['debug', 'log', 'warn', 'error']
*/
logLevel: string;
/**
*
* @param {any} type being registered. This could be ANY top level variable among project.
* @param {string} uniqueLocalName - variable name
* @param {string} fileName - origin file
* @return {any}
*/
onComponentRegister: (type: any, uniqueLocalName: string, fileName: string) => any;
/**
*
* @param type {any} type being rendered. The first argument of React.createElement
* @param displayName {string} type display name (if exists)
*/
onComponentCreate: (type: any, displayName: string) => any;
/**
* Allows using SFC without changes. leading to some components not updated
*/
pureSFC: boolean;
/**
* keep render method unpatched, moving sideEffect to componentDidUpdate
*/
pureRender: boolean;
/**
* Allows SFC to be used, enables "intermediate" components used by Relay, should be disabled for Preact
*/
allowSFC: boolean;
/**
* Disable "hot-replacement-render"
*/
disableHotRenderer: boolean;
/**
* Disable "hot-replacement-render" when injection into react-dom are made
*/
disableHotRendererWhenInjected: boolean;
/**
* Show "hot-loader/react-dom" warning
*/
showReactDomPatchNotification: boolean;
/**
* flag to completely disable RHL for SFC
*/
ignoreSFC: boolean;
/**
* flag to completely disable RHL for Components
*/
ignoreComponents: boolean;
/**
* enables or disables hooks treatment
*/
reloadHooks: boolean;
/**
* default value for AppContainer errorOverlay
*/
errorReporter: React.ComponentType<HotError>;
/**
* Global error overlay
*/
ErrorOverlay: React.ComponentType<{ errors: Array<HotError> }>;
/**
* Controls tail(deferred) update checking
*/
trackTailUpdates: boolean;
}
/**
* Confugures how React Hot Loader works
* @param {Config} config
*/
export function setConfig(config: Partial<Config>): void;
|