mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add type definitions for react-notify-toast (#27052)
* Add type definitions for react-notify-toast * use 4 spaces * add comments * Fix issues
This commit is contained in:
parent
f83dee6c0e
commit
98b8fc3a97
33
types/react-notify-toast/index.d.ts
vendored
Normal file
33
types/react-notify-toast/index.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Type definitions for react-notify-toast 0.5
|
||||
// Project: https://github.com/jesusoterogomez/react-notify-toast
|
||||
// Definitions by: Klaas Cuvelier <https://github.com/klaascuvelier>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
interface reactNotifyToastColor {
|
||||
background: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
declare class reactNotifyToast {
|
||||
show(
|
||||
text: string,
|
||||
type?: 'success' | 'error' | 'warning' | 'custom',
|
||||
timeout?: number,
|
||||
color?: reactNotifyToastColor
|
||||
): void;
|
||||
|
||||
hide(): void;
|
||||
createShowQueue(): reactNotifyToast;
|
||||
}
|
||||
|
||||
interface NotificationProps {
|
||||
options: any;
|
||||
}
|
||||
|
||||
export class Notification extends React.Component<NotificationProps, any> {}
|
||||
|
||||
export const notify: reactNotifyToast;
|
||||
export default Notification;
|
||||
20
types/react-notify-toast/react-notify-toast-tests.tsx
Normal file
20
types/react-notify-toast/react-notify-toast-tests.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import Notification, { notify } from 'react-notify-toast';
|
||||
|
||||
export class NotificationTest extends React.Component {
|
||||
render() {
|
||||
return(<Notification options={{zIndex: 200, top: '15px'}} />);
|
||||
}
|
||||
}
|
||||
|
||||
function testNotify() {
|
||||
notify.show('show something');
|
||||
notify.show('show error', 'error');
|
||||
notify.show('show warning', 'warning', 100);
|
||||
|
||||
const queue = notify.createShowQueue();
|
||||
queue.show('hi');
|
||||
queue.show('test');
|
||||
|
||||
notify.hide();
|
||||
}
|
||||
25
types/react-notify-toast/tsconfig.json
Normal file
25
types/react-notify-toast/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-notify-toast-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/react-notify-toast/tslint.json
Normal file
1
types/react-notify-toast/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user