mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #21761 from shssoichiro/react-toastr
Add initial typings for react-toastr
This commit is contained in:
20
types/react-toastr/index.d.ts
vendored
Normal file
20
types/react-toastr/index.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for react-toastr 3.0
|
||||
// Project: https://github.com/tomchentw/react-toastr
|
||||
// Definitions by: Josh Holmer <https://github.com/shssoichiro>
|
||||
// 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;
|
||||
22
types/react-toastr/react-toastr-tests.tsx
Normal file
22
types/react-toastr/react-toastr-tests.tsx
Normal file
@@ -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 (
|
||||
<ToastContainer
|
||||
ref={this.toastRef}
|
||||
toastMessageFactory={toastMessageFactory}
|
||||
className="toast-top-right"
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
25
types/react-toastr/tsconfig.json
Normal file
25
types/react-toastr/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
1
types/react-toastr/tslint.json
Normal file
1
types/react-toastr/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user