diff --git a/types/react-toastr/index.d.ts b/types/react-toastr/index.d.ts new file mode 100644 index 0000000000..2de77a6d7e --- /dev/null +++ b/types/react-toastr/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for react-toastr 3.0 +// Project: https://github.com/tomchentw/react-toastr +// Definitions by: Josh Holmer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Component, ReactHTML } from 'react'; + +export class ToastContainer extends Component<{ + toastMessageFactory: any; + className?: string; +}> { + error: (message: string, title: string, optionsOverride?: {}) => void; + info: (message: string, title: string, optionsOverride?: {}) => void; + success: (message: string, title: string, optionsOverride?: {}) => void; + warning: (message: string, title: string, optionsOverride?: {}) => void; + clear: () => void; +} +export const ToastMessageAnimated: keyof ReactHTML; +export const ToastMessagejQuery: keyof ReactHTML; diff --git a/types/react-toastr/react-toastr-tests.tsx b/types/react-toastr/react-toastr-tests.tsx new file mode 100644 index 0000000000..75d6527730 --- /dev/null +++ b/types/react-toastr/react-toastr-tests.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { ToastContainer, ToastMessageAnimated } from 'react-toastr'; + +const toastMessageFactory = React.createFactory(ToastMessageAnimated); + +class Test extends React.Component { + ref: ToastContainer; + + toastRef = (ref: ToastContainer) => { + this.ref = ref; + } + + render() { + return ( + + ); + } +} diff --git a/types/react-toastr/tsconfig.json b/types/react-toastr/tsconfig.json new file mode 100644 index 0000000000..1fbbfde4af --- /dev/null +++ b/types/react-toastr/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-toastr-tests.tsx" + ] +} diff --git a/types/react-toastr/tslint.json b/types/react-toastr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-toastr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }