mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Add definitions for react-notification-system-redux (#13431)
* Add definitions for react-notification-system-redux * Add semicolor, add missing compiler option
This commit is contained in:
parent
43751cf91f
commit
08c8f92a86
39
react-notification-system-redux/index.d.ts
vendored
Normal file
39
react-notification-system-redux/index.d.ts
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Type definitions for react-notification-system-redux 1.0
|
||||
// Project: https://github.com/gor181/react-notification-system-redux
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Component } from "react";
|
||||
import { Action } from "redux";
|
||||
import { Attributes, Notification } from "react-notification-system";
|
||||
|
||||
export as namespace Notifications;
|
||||
|
||||
export = Notifications;
|
||||
|
||||
declare class Notifications extends Component<Notifications.NotificationsProps, any> {}
|
||||
|
||||
declare namespace Notifications {
|
||||
|
||||
export type NotificationsState = Notification[];
|
||||
|
||||
export type NotificationLevel = "error" | "warning" | "info" | "success";
|
||||
|
||||
export type NotificationsReducer<A extends Action> = (state: NotificationsState, action: A) => NotificationsState;
|
||||
|
||||
export type NotificationShow = (opts?: Notification) => Action;
|
||||
|
||||
export interface NotificationsProps extends Attributes {
|
||||
notifications?: Notification[];
|
||||
}
|
||||
|
||||
export const reducer: NotificationsReducer<any>;
|
||||
|
||||
export const show: (opts?: Notification, level?: NotificationLevel) => Action;
|
||||
export const error: NotificationShow;
|
||||
export const hide: (opts?: Notification | string | number) => Action;
|
||||
export const info: NotificationShow;
|
||||
export const success: NotificationShow;
|
||||
export const warning: NotificationShow;
|
||||
}
|
||||
|
||||
5
react-notification-system-redux/package.json
Normal file
5
react-notification-system-redux/package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.6.0"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
import * as React from "react";
|
||||
import { createStore, Store } from "redux";
|
||||
import { Notification } from "react-notification-system";
|
||||
import * as Notifications from "react-notification-system-redux";
|
||||
import { reducer, show, hide, info, error, warning, success, NotificationLevel } from "react-notification-system-redux";
|
||||
|
||||
class Test extends React.Component<any, any> {
|
||||
|
||||
private test () {
|
||||
const notification: Notification = {
|
||||
message : "Test"
|
||||
};
|
||||
info(notification);
|
||||
error(notification);
|
||||
warning(notification);
|
||||
success(notification);
|
||||
show(notification, "info");
|
||||
show(notification, "error");
|
||||
show(notification, "warning");
|
||||
show(notification, "success");
|
||||
hide(notification);
|
||||
hide("uid");
|
||||
hide(123);
|
||||
}
|
||||
|
||||
public render () {
|
||||
const notifications: Notification[] = [];
|
||||
return (<Notifications notifications={ notifications } />);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const store: Store<any> = createStore(reducer)
|
||||
21
react-notification-system-redux/tsconfig.json
Normal file
21
react-notification-system-redux/tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-notification-system-redux-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
react-notification-system-redux/tslint.json
Normal file
1
react-notification-system-redux/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
Loading…
Reference in New Issue
Block a user