forked from gaearon/react-hot-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-hot-loader.d.ts
58 lines (52 loc) · 1.63 KB
/
react-hot-loader.d.ts
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
declare module 'react-hot-loader' {
import * as React from 'react'
interface ErrorReporterProps {
error: any
}
export interface AppContainerProps {
children?: React.ReactElement<any>
errorReporter?:
| React.ComponentClass<ErrorReporterProps>
| React.StatelessComponent<ErrorReporterProps>
}
export class AppContainer extends React.Component<
AppContainerProps,
React.ComponentState
> {}
/**
* 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) => 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 Config {
/**
* Specify loglLevel, default to 'error', set it to false to disable logs.
* Available levels: ['debug', 'log', 'warn', 'error']
*/
logLevel?: string
}
/**
* Confugures how React Hot Loader works
* @param {Config} config
*/
export function setConfig(config: Config): void
}