mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 20:21:46 +00:00
Merge pull request #12632 from JacekJagiello/react-hot-loader
Added type definitions for react-hot-loader
This commit is contained in:
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for react-hot-loader 3.0
|
||||
// Project: https://github.com/gaearon/react-hot-loader
|
||||
// Definitions by: Jacek Jagiello <https://github.com/jacekjagiello/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
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, {}> {}
|
||||
@@ -0,0 +1,29 @@
|
||||
import * as React from 'react'
|
||||
import { AppContainer } from 'react-hot-loader'
|
||||
|
||||
interface ErrorReporterProps {
|
||||
error: any
|
||||
}
|
||||
|
||||
class ErrorReporterComponent extends React.Component<ErrorReporterProps, any> {
|
||||
public render() {
|
||||
return <p>{this.props.error.message}</p>
|
||||
}
|
||||
}
|
||||
|
||||
const DummyComponent = () => <p>Dummy component</p>
|
||||
const ErrorReporter = ({ error } : ErrorReporterProps) => <ErrorReporterComponent error={error} />
|
||||
|
||||
class AppContainerTest extends React.Component<any, any> {
|
||||
public render() {
|
||||
return (
|
||||
<div>
|
||||
<AppContainer errorReporter={ErrorReporterComponent}>
|
||||
<DummyComponent />
|
||||
</AppContainer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default AppContainerTest
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-hot-loader-tests.tsx"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user