mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-20 06:12:54 +08:00
* Support Partial<> on setState now that TS 2.1 is out * Update readme to reflect setState being typed correctly * Switch setState to Pick * Restore cloneELement portion of readme * Use Pick<> | S for setState due to cast issue * state and props should be readonly * Fix nit + document why we * Add typescript compiler header * Update to properly order headers * Update readme to reflect 2.1.5 fixing stPick * Update readme now that 2.1.5 is out * All that depend on react now require 2.1 * Fix definition that fails due to readonly state
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
// 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
|
|
// TypeScript Version: 2.1
|
|
|
|
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;
|
|
}
|
|
|