Prefer to directly export values instead of export = of a namespace (#13645)

This commit is contained in:
Andy 2017-01-01 15:36:12 -08:00 committed by GitHub
parent d389dfdb83
commit 3633866ea5
9 changed files with 487 additions and 519 deletions

57
argon2/index.d.ts vendored
View File

@ -5,40 +5,35 @@
/// <reference types="node" />
declare namespace argon2 {
export var defaults: {
timeCost: number;
memoryCost: number;
parallelism: number;
argon2d: boolean;
};
export var defaults: {
timeCost: number;
memoryCost: number;
parallelism: number;
argon2d: boolean;
export var limits: {
memoryCost: {
min: number;
max: number;
};
export var limits: {
memoryCost: {
min: number;
max: number;
};
timeCost: {
min: number;
max: number;
};
parallelism: {
min: number;
max: number;
};
timeCost: {
min: number;
max: number;
};
parallelism: {
min: number;
max: number;
};
};
export function hash(plain: string, salt: Buffer, options?: {
timeCost?: number;
memoryCost?: number;
parallelism?: number;
argon2d?: boolean;
}): Promise<string>;
export function hash(plain: string, salt: Buffer, options?: {
timeCost?: number;
memoryCost?: number;
parallelism?: number;
argon2d?: boolean;
}): Promise<string>;
export function verify(hash: string, plain: string): Promise<boolean>;
export function verify(hash: string, plain: string): Promise<boolean>;
export function generateSalt(length?: number): Promise<Buffer>;
}
export = argon2;
export function generateSalt(length?: number): Promise<Buffer>;

152
halogen/index.d.ts vendored
View File

@ -5,84 +5,78 @@
import * as react from "react";
export = Halogen;
declare namespace Halogen {
type VerticalAlign = "baseline" | "length" | "sub" | "super" | "top" | "text-top" | "middle" | "bottom" | "text-bottom" | "initial" | "inherit";
interface HalogenCommonProps {
loading?: boolean;
color?: string;
id?: string;
className?: string;
verticalAlign?: VerticalAlign;
}
interface SizeLoaderProps extends HalogenCommonProps {
size?: string;
}
interface MarginLoaderProps<T> extends HalogenCommonProps {
margin?: T;
size?: T;
}
interface RadiusLoaderProps extends MarginLoaderProps<string> {
height?: string;
width?: string;
radius?: string;
}
/**
* React components
*/
type PulseLoader = react.Component<MarginLoaderProps<string>, {}>;
export const PulseLoader: react.ComponentClass<MarginLoaderProps<string>>;
type RotateLoader = react.Component<MarginLoaderProps<string>, {}>;
export const RotateLoader: react.ComponentClass<MarginLoaderProps<string>>;
type BeatLoader = react.Component<MarginLoaderProps<string>, {}>;
export const BeatLoader: react.ComponentClass<MarginLoaderProps<string>>;
type RiseLoader = react.Component<MarginLoaderProps<string>, {}>;
export const RiseLoader: react.ComponentClass<MarginLoaderProps<string>>;
type SyncLoader = react.Component<MarginLoaderProps<string>, {}>;
export const SyncLoader: react.ComponentClass<MarginLoaderProps<string>>;
type GridLoader = react.Component<MarginLoaderProps<string>, {}>;
export const GridLoader: react.ComponentClass<MarginLoaderProps<string>>;
type ClipLoader = react.Component<SizeLoaderProps, {}>;
export const ClipLoader: react.ComponentClass<SizeLoaderProps>;
type SquareLoader = react.Component<SizeLoaderProps, {}>;
export const SquareLoader: react.ComponentClass<SizeLoaderProps>;
type DotLoader = react.Component<SizeLoaderProps, {}>;
export const DotLoader: react.ComponentClass<SizeLoaderProps>;
type PacmanLoader = react.Component<MarginLoaderProps<number>, {}>;
export const PacmanLoader: react.ComponentClass<MarginLoaderProps<number>>;
type MoonLoader = react.Component<SizeLoaderProps, {}>;
export const MoonLoader: react.ComponentClass<SizeLoaderProps>;
type RingLoader = react.Component<SizeLoaderProps, {}>;
export const RingLoader: react.ComponentClass<SizeLoaderProps>;
type BounceLoader = react.Component<SizeLoaderProps, {}>;
export const BounceLoader: react.ComponentClass<SizeLoaderProps>;
type SkewLoader = react.Component<SizeLoaderProps, {}>;
export const SkewLoader: react.ComponentClass<SizeLoaderProps>;
type FadeLoader = react.Component<RadiusLoaderProps, {}>;
export const FadeLoader: react.ComponentClass<RadiusLoaderProps>;
type ScaleLoader = react.Component<RadiusLoaderProps, {}>;
export const ScaleLoader: react.ComponentClass<RadiusLoaderProps>;
type VerticalAlign = "baseline" | "length" | "sub" | "super" | "top" | "text-top" | "middle" | "bottom" | "text-bottom" | "initial" | "inherit";
interface HalogenCommonProps {
loading?: boolean;
color?: string;
id?: string;
className?: string;
verticalAlign?: VerticalAlign;
}
interface SizeLoaderProps extends HalogenCommonProps {
size?: string;
}
interface MarginLoaderProps<T> extends HalogenCommonProps {
margin?: T;
size?: T;
}
interface RadiusLoaderProps extends MarginLoaderProps<string> {
height?: string;
width?: string;
radius?: string;
}
/**
* React components
*/
type PulseLoader = react.Component<MarginLoaderProps<string>, {}>;
export const PulseLoader: react.ComponentClass<MarginLoaderProps<string>>;
type RotateLoader = react.Component<MarginLoaderProps<string>, {}>;
export const RotateLoader: react.ComponentClass<MarginLoaderProps<string>>;
type BeatLoader = react.Component<MarginLoaderProps<string>, {}>;
export const BeatLoader: react.ComponentClass<MarginLoaderProps<string>>;
type RiseLoader = react.Component<MarginLoaderProps<string>, {}>;
export const RiseLoader: react.ComponentClass<MarginLoaderProps<string>>;
type SyncLoader = react.Component<MarginLoaderProps<string>, {}>;
export const SyncLoader: react.ComponentClass<MarginLoaderProps<string>>;
type GridLoader = react.Component<MarginLoaderProps<string>, {}>;
export const GridLoader: react.ComponentClass<MarginLoaderProps<string>>;
type ClipLoader = react.Component<SizeLoaderProps, {}>;
export const ClipLoader: react.ComponentClass<SizeLoaderProps>;
type SquareLoader = react.Component<SizeLoaderProps, {}>;
export const SquareLoader: react.ComponentClass<SizeLoaderProps>;
type DotLoader = react.Component<SizeLoaderProps, {}>;
export const DotLoader: react.ComponentClass<SizeLoaderProps>;
type PacmanLoader = react.Component<MarginLoaderProps<number>, {}>;
export const PacmanLoader: react.ComponentClass<MarginLoaderProps<number>>;
type MoonLoader = react.Component<SizeLoaderProps, {}>;
export const MoonLoader: react.ComponentClass<SizeLoaderProps>;
type RingLoader = react.Component<SizeLoaderProps, {}>;
export const RingLoader: react.ComponentClass<SizeLoaderProps>;
type BounceLoader = react.Component<SizeLoaderProps, {}>;
export const BounceLoader: react.ComponentClass<SizeLoaderProps>;
type SkewLoader = react.Component<SizeLoaderProps, {}>;
export const SkewLoader: react.ComponentClass<SizeLoaderProps>;
type FadeLoader = react.Component<RadiusLoaderProps, {}>;
export const FadeLoader: react.ComponentClass<RadiusLoaderProps>;
type ScaleLoader = react.Component<RadiusLoaderProps, {}>;
export const ScaleLoader: react.ComponentClass<RadiusLoaderProps>;

View File

@ -5,89 +5,85 @@
import { StateNavigator } from 'navigation';
import { Component, HTMLProps } from 'react';
export = NavigationReact;
declare namespace NavigationReact {
/**
* Defines the Link Props contract
*/
interface LinkProps extends HTMLProps<HTMLAnchorElement> {
/**
* Defines the Link Props contract
* Indicates whether Links listen for navigate events
*/
interface LinkProps extends HTMLProps<HTMLAnchorElement> {
/**
* Indicates whether Links listen for navigate events
*/
lazy?: boolean;
/**
* Determines the effect on browser history
*/
historyAction?: 'add' | 'replace' | 'none';
/**
* Handles Link click events
*/
navigating?: (e: MouseEvent, domId: string, link: string) => boolean;
/**
* The State Navigator
*/
stateNavigator?: StateNavigator;
}
lazy?: boolean;
/**
* Defines the Refresh Link Props contract
* Determines the effect on browser history
*/
interface RefreshLinkProps extends LinkProps {
/**
* The NavigationData to pass
*/
navigationData?: any;
/**
* Indicates whether to include all the current NavigationData
*/
includeCurrentData?: boolean;
/**
* The data to add from the current NavigationData
*/
currentDataKeys?: string;
/**
* The Css Class to display when the Link is active
*/
activeCssClass?: string;
/**
* Indicates whether the Link is disabled when active
*/
disableActive?: boolean;
}
historyAction?: 'add' | 'replace' | 'none';
/**
* Hyperlink Component the navigates to the current State
* Handles Link click events
*/
class RefreshLink extends Component<RefreshLinkProps, any> { }
navigating?: (e: MouseEvent, domId: string, link: string) => boolean;
/**
* Defines the Navigation Link Props contract
* The State Navigator
*/
interface NavigationLinkProps extends RefreshLinkProps {
/**
* The key of the State to navigate to
*/
stateKey: string;
}
/**
* Hyperlink Component the navigates to a State
*/
class NavigationLink extends Component<NavigationLinkProps, any> { }
/**
* Defines the Navigation Back Link Props contract
*/
interface NavigationBackLinkProps extends RefreshLinkProps {
/**
* Starting at 1, The number of Crumb steps to go back
*/
distance: number;
}
/**
* Hyperlink Component the navigates back along the crumb trail
*/
class NavigationBackLink extends Component<NavigationBackLinkProps, any> { }
stateNavigator?: StateNavigator;
}
/**
* Defines the Refresh Link Props contract
*/
interface RefreshLinkProps extends LinkProps {
/**
* The NavigationData to pass
*/
navigationData?: any;
/**
* Indicates whether to include all the current NavigationData
*/
includeCurrentData?: boolean;
/**
* The data to add from the current NavigationData
*/
currentDataKeys?: string;
/**
* The Css Class to display when the Link is active
*/
activeCssClass?: string;
/**
* Indicates whether the Link is disabled when active
*/
disableActive?: boolean;
}
/**
* Hyperlink Component the navigates to the current State
*/
export class RefreshLink extends Component<RefreshLinkProps, any> { }
/**
* Defines the Navigation Link Props contract
*/
interface NavigationLinkProps extends RefreshLinkProps {
/**
* The key of the State to navigate to
*/
stateKey: string;
}
/**
* Hyperlink Component the navigates to a State
*/
export class NavigationLink extends Component<NavigationLinkProps, any> { }
/**
* Defines the Navigation Back Link Props contract
*/
interface NavigationBackLinkProps extends RefreshLinkProps {
/**
* Starting at 1, The number of Crumb steps to go back
*/
distance: number;
}
/**
* Hyperlink Component the navigates back along the crumb trail
*/
export class NavigationBackLink extends Component<NavigationBackLinkProps, any> { }

View File

@ -5,186 +5,182 @@
/// <reference types="react-native" />
declare namespace RNFS {
interface ReadDirItem {
// The name of the item
name: string;
// The absolute path to the item
path: string;
// Size in bytes
size: string;
// Is the file just a file?
isFile(): boolean;
// Is the file a directory?
isDirectory(): boolean;
}
interface StatResult {
// The name of the item
name: string;
// The absolute path to the item
path: string;
// Size in bytes
size: string;
// UNIX file mode
mode: number;
// Is the file just a file?
isFile(): boolean;
// Is the file a directory?
isDirectory(): boolean;
}
interface Headers {
[index: string]: string;
}
type Fields = Headers;
interface MkdirOptions {
// iOS only
NSURLIsExcludedFromBackupKey?: boolean;
}
interface DownloadResult {
// The download job ID, required if one wishes to cancel the download. See `stopDownload`.
jobId: number;
// The HTTP status code
statusCode: number;
// The number of bytes written to the file
bytesWritten: number;
}
type DownloadCallbackBegin = (res: DownloadBeginCallbackResult) => void;
type DownloadCallbackProgress = (res: DownloadProgressCallbackResult) => void;
interface DownloadFileOptions {
// URL to download file from
fromUrl: string;
// Local filesystem path to save the file to
toFile: string;
// An object of headers to be passed to the server
headers?: Headers;
background?: boolean;
progressDivider?: number;
begin?: DownloadCallbackBegin;
progress?: DownloadCallbackProgress;
}
interface DownloadProgressCallbackResult {
// The download job ID, required if one wishes to cancel the download. See `stopDownload`.
jobId: number;
// The total size in bytes of the download resource
contentLength: number;
// The number of bytes written to the file so far
bytesWritten: number;
}
interface DownloadBeginCallbackResult {
// The download job ID, required if one wishes to cancel the download. See `stopDownload`.
jobId: number;
// The HTTP status code
statusCode: number;
// The total size in bytes of the download resource
contentLength: number;
// The HTTP response headers from the server
headers: Headers;
}
type UploadCallbackBegin = (res: UploadBeginCallbackResult) => void;
type UploadCallbackProgress = (res: UploadProgressCallbackResult) => void;
interface UploadFileOptions {
// URL to upload file to
toUrl: string;
// An array of objects with the file information to be uploaded.
files: UploadFileItem[];
// An object of headers to be passed to the server
headers?: Headers;
// An object of fields to be passed to the server
fields?: Fields;
// Default is 'POST', supports 'POST' and 'PUT'
method?: string;
begin?: UploadCallbackBegin;
progress?: UploadCallbackProgress;
}
interface UploadResult {
// The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
jobId: number;
// The HTTP status code
statusCode: number;
// The HTTP response headers from the server
headers: Headers;
// The HTTP response body
body: string;
}
interface UploadFileItem {
// Name of the file, if not defined then filename is used
name: string;
// Name of file
filename: string;
// Path to file
filepath: string;
// The mimetype of the file to be uploaded, if not defined it will get mimetype from `filepath` extension
filetype: string;
}
interface UploadBeginCallbackResult {
// The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
jobId: number;
}
interface UploadProgressCallbackResult {
// The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
jobId: number;
// The total number of bytes that will be sent to the server
totalBytesExpectedToSend: number;
// The number of bytes sent to the server
totalBytesSent: number;
}
interface FSInfoResult {
// The total amount of storage space on the device (in bytes).
totalSpace: number;
// The amount of available storage space on the device (in bytes).
freeSpace: number;
}
interface JobReturnValue<Result> {
jobId: number;
promise: Promise<Result>;
}
// The absolute path to the main bundle directory
export const MainBundlePath: string;
// The absolute path to the caches directory
export const CachesDirectoryPath: string;
// The absolute path to the document directory
export const DocumentDirectoryPath: string;
// The absolute path to the temporary directory (iOS only)
export const TemporaryDirectoryPath: string;
// The absolute path to the external files, shared directory (android only)
export const ExternalDirectoryPath: string;
// The absolute path to the external storage, shared directory (android only)
export const ExternalStorageDirectoryPath: string;
export function readDir(path: string): Promise<ReadDirItem[]>;
export function readdir(path: string): Promise<string[]>;
export function stat(filepath: string): Promise<StatResult>;
export function readFile(filepath: string, encoding?: string): Promise<string>;
export function unlink(filepath: string): Promise<void>;
export function writeFile(filepath: string, contents: string, encoding?: string): Promise<void>;
export function appendFile(filepath: string, contents: string, encoding?: string): Promise<void>;
export function moveFile(filepath: string, destPath: string): Promise<void>;
export function copyFile(filepath: string, destPath: string): Promise<void>;
export function exists(filepath: string): Promise<boolean>;
export function hash(filepath: string, algorithm: string): Promise<string>;
export function mkdir(filepath: string, options?: MkdirOptions): Promise<void>;
export function downloadFile(options: DownloadFileOptions): JobReturnValue<DownloadResult>;
export function stopDownload(jobId: number): Promise<void>;
export function uploadFiles(options: UploadFileOptions): JobReturnValue<UploadResult>;
export function stopUpload(jobId: number): Promise<void>;
export function getFSInfo(): Promise<FSInfoResult>;
interface ReadDirItem {
// The name of the item
name: string;
// The absolute path to the item
path: string;
// Size in bytes
size: string;
// Is the file just a file?
isFile(): boolean;
// Is the file a directory?
isDirectory(): boolean;
}
export = RNFS;
interface StatResult {
// The name of the item
name: string;
// The absolute path to the item
path: string;
// Size in bytes
size: string;
// UNIX file mode
mode: number;
// Is the file just a file?
isFile(): boolean;
// Is the file a directory?
isDirectory(): boolean;
}
interface Headers {
[index: string]: string;
}
type Fields = Headers;
interface MkdirOptions {
// iOS only
NSURLIsExcludedFromBackupKey?: boolean;
}
interface DownloadResult {
// The download job ID, required if one wishes to cancel the download. See `stopDownload`.
jobId: number;
// The HTTP status code
statusCode: number;
// The number of bytes written to the file
bytesWritten: number;
}
type DownloadCallbackBegin = (res: DownloadBeginCallbackResult) => void;
type DownloadCallbackProgress = (res: DownloadProgressCallbackResult) => void;
interface DownloadFileOptions {
// URL to download file from
fromUrl: string;
// Local filesystem path to save the file to
toFile: string;
// An object of headers to be passed to the server
headers?: Headers;
background?: boolean;
progressDivider?: number;
begin?: DownloadCallbackBegin;
progress?: DownloadCallbackProgress;
}
interface DownloadProgressCallbackResult {
// The download job ID, required if one wishes to cancel the download. See `stopDownload`.
jobId: number;
// The total size in bytes of the download resource
contentLength: number;
// The number of bytes written to the file so far
bytesWritten: number;
}
interface DownloadBeginCallbackResult {
// The download job ID, required if one wishes to cancel the download. See `stopDownload`.
jobId: number;
// The HTTP status code
statusCode: number;
// The total size in bytes of the download resource
contentLength: number;
// The HTTP response headers from the server
headers: Headers;
}
type UploadCallbackBegin = (res: UploadBeginCallbackResult) => void;
type UploadCallbackProgress = (res: UploadProgressCallbackResult) => void;
interface UploadFileOptions {
// URL to upload file to
toUrl: string;
// An array of objects with the file information to be uploaded.
files: UploadFileItem[];
// An object of headers to be passed to the server
headers?: Headers;
// An object of fields to be passed to the server
fields?: Fields;
// Default is 'POST', supports 'POST' and 'PUT'
method?: string;
begin?: UploadCallbackBegin;
progress?: UploadCallbackProgress;
}
interface UploadResult {
// The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
jobId: number;
// The HTTP status code
statusCode: number;
// The HTTP response headers from the server
headers: Headers;
// The HTTP response body
body: string;
}
interface UploadFileItem {
// Name of the file, if not defined then filename is used
name: string;
// Name of file
filename: string;
// Path to file
filepath: string;
// The mimetype of the file to be uploaded, if not defined it will get mimetype from `filepath` extension
filetype: string;
}
interface UploadBeginCallbackResult {
// The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
jobId: number;
}
interface UploadProgressCallbackResult {
// The upload job ID, required if one wishes to cancel the upload. See `stopUpload`.
jobId: number;
// The total number of bytes that will be sent to the server
totalBytesExpectedToSend: number;
// The number of bytes sent to the server
totalBytesSent: number;
}
interface FSInfoResult {
// The total amount of storage space on the device (in bytes).
totalSpace: number;
// The amount of available storage space on the device (in bytes).
freeSpace: number;
}
interface JobReturnValue<Result> {
jobId: number;
promise: Promise<Result>;
}
// The absolute path to the main bundle directory
export const MainBundlePath: string;
// The absolute path to the caches directory
export const CachesDirectoryPath: string;
// The absolute path to the document directory
export const DocumentDirectoryPath: string;
// The absolute path to the temporary directory (iOS only)
export const TemporaryDirectoryPath: string;
// The absolute path to the external files, shared directory (android only)
export const ExternalDirectoryPath: string;
// The absolute path to the external storage, shared directory (android only)
export const ExternalStorageDirectoryPath: string;
export function readDir(path: string): Promise<ReadDirItem[]>;
export function readdir(path: string): Promise<string[]>;
export function stat(filepath: string): Promise<StatResult>;
export function readFile(filepath: string, encoding?: string): Promise<string>;
export function unlink(filepath: string): Promise<void>;
export function writeFile(filepath: string, contents: string, encoding?: string): Promise<void>;
export function appendFile(filepath: string, contents: string, encoding?: string): Promise<void>;
export function moveFile(filepath: string, destPath: string): Promise<void>;
export function copyFile(filepath: string, destPath: string): Promise<void>;
export function exists(filepath: string): Promise<boolean>;
export function hash(filepath: string, algorithm: string): Promise<string>;
export function mkdir(filepath: string, options?: MkdirOptions): Promise<void>;
export function downloadFile(options: DownloadFileOptions): JobReturnValue<DownloadResult>;
export function stopDownload(jobId: number): Promise<void>;
export function uploadFiles(options: UploadFileOptions): JobReturnValue<UploadResult>;
export function stopUpload(jobId: number): Promise<void>;
export function getFSInfo(): Promise<FSInfoResult>;

View File

@ -4,21 +4,18 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { ReactElement } from "react";
declare namespace ReactTestRenderer {
export interface Renderer {
toJSON(): ReactTestRendererJSON;
}
export interface ReactTestRendererJSON {
type: string;
props: { [propName: string]: string };
children: null | Array<string | ReactTestRendererJSON>;
$$typeof?: any;
}
export interface TestRendererOptions {
createNodeMock: (element: ReactElement<any>) => any;
}
// https://github.com/facebook/react/blob/master/src/renderers/testing/ReactTestMount.js#L155
export function create(nextElement: ReactElement<any>, options?: TestRendererOptions): Renderer;
}
export = ReactTestRenderer;
interface Renderer {
toJSON(): ReactTestRendererJSON;
}
interface ReactTestRendererJSON {
type: string;
props: { [propName: string]: string };
children: null | Array<string | ReactTestRendererJSON>;
$$typeof?: any;
}
interface TestRendererOptions {
createNodeMock: (element: ReactElement<any>) => any;
}
// https://github.com/facebook/react/blob/master/src/renderers/testing/ReactTestMount.js#L155
export function create(nextElement: ReactElement<any>, options?: TestRendererOptions): Renderer;

View File

@ -3,115 +3,112 @@
// Definitions by: Jack Hsu <https://github.com/jaysoo>, Alex Gorbatchev <https://github.com/alexgorbatchev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = ReduxActions;
export as namespace ReduxActions;
declare namespace ReduxActions {
// FSA-compliant action.
// See: https://github.com/acdlite/flux-standard-action
interface BaseAction {
type: string;
}
export interface Action<Payload> extends BaseAction {
payload?: Payload;
error?: boolean;
}
export interface ActionMeta<Payload, Meta> extends Action<Payload> {
meta: Meta;
}
interface ReducerMap<State, Payload> {
[actionType: string]: Reducer<State, Payload> | ReducerNextThrow<State, Payload>;
}
interface ReducerMapMeta<State, Payload, Meta> {
[actionType: string]: Reducer<State, Payload> | ReducerNextThrow<State, Payload>;
}
interface ReducerNextThrow<State, Payload> {
next?(state: State, action: Action<Payload>): State;
throw?(state: State, action: Action<Payload>): State;
}
interface ReducerNextThrowMeta<State, Payload, Meta> {
next?(state: State, action: ActionMeta<Payload, Meta>): State;
throw?(state: State, action: ActionMeta<Payload, Meta>): State;
}
type ActionFunctions<Payload> = ActionFunction0<Action<Payload>> | ActionFunction1<any, Action<Payload>> | ActionFunction2<any, any, Action<Payload>> | ActionFunction3<any, any, any, Action<Payload>> | ActionFunction4<any, any, any, any, Action<Payload>> | ActionFunctionAny<Action<Payload>>;
type Reducer<State, Payload> = (state: State, action: Action<Payload>) => State;
type ReducerMeta<State, Payload, Meta> = (state: State, action: ActionMeta<Payload, Meta>) => State;
/** argument inferring borrowed from lodash definitions */
type ActionFunction0<R> = () => R;
type ActionFunction1<T1, R> = (t1: T1) => R;
type ActionFunction2<T1, T2, R> = (t1: T1, t2: T2) => R;
type ActionFunction3<T1, T2, T3, R> = (t1: T1, t2: T2, t3: T3) => R;
type ActionFunction4<T1, T2, T3, T4, R> = (t1: T1, t2: T2, t3: T3, t4: T4) => R;
type ActionFunctionAny<R> = (...args: any[]) => R;
export function createAction<Payload>(
actionType: string,
payloadCreator: ActionFunction0<Payload>
): ActionFunction0<Action<Payload>>;
export function createAction<Payload, Arg1>(
actionType: string,
payloadCreator: ActionFunction1<Arg1, Payload>
): ActionFunction1<Arg1, Action<Payload>>;
export function createAction<Payload, Arg1, Arg2>(
actionType: string,
payloadCreator: ActionFunction2<Arg1, Arg2, Payload>
): ActionFunction2<Arg1, Arg2, Action<Payload>>;
export function createAction<Payload, Arg1, Arg2, Arg3>(
actionType: string,
payloadCreator: ActionFunction3<Arg1, Arg2, Arg3, Payload>
): ActionFunction3<Arg1, Arg2, Arg3, Action<Payload>>;
export function createAction<Payload, Arg1, Arg2, Arg3, Arg4>(
actionType: string,
payloadCreator: ActionFunction4<Arg1, Arg2, Arg3, Arg4, Payload>
): ActionFunction4<Arg1, Arg2, Arg3, Arg4, Action<Payload>>;
export function createAction<Payload>(
actionType: string
): ActionFunctionAny<Action<Payload>>;
export function createAction<Payload, Meta>(
actionType: string,
payloadCreator: (...args: any[]) => Payload,
metaCreator: (...args: any[]) => Meta
): (...args: any[]) => ActionMeta<Payload, Meta>;
export function handleAction<State, Payload>(
actionType: string | ActionFunctions<Payload>,
reducer: Reducer<State, Payload> | ReducerNextThrow<State, Payload>,
initialState: State
): Reducer<State, Payload>;
export function handleAction<State, Payload, Meta>(
actionType: { toString(): string },
reducer: ReducerMeta<State, Payload, Meta> | ReducerNextThrowMeta<State, Payload, Meta>,
initialState: State
): Reducer<State, Payload>;
export function handleActions<StateAndPayload>(
reducerMap: ReducerMap<StateAndPayload, StateAndPayload>,
initialState: StateAndPayload
): Reducer<StateAndPayload, StateAndPayload>;
export function handleActions<State, Payload>(
reducerMap: ReducerMap<State, Payload>,
initialState: State
): Reducer<State, Payload>;
export function combineActions(
...actionTypes: Array<ActionFunctions<any>>
): Array<ActionFunctions<any>>;
// FSA-compliant action.
// See: https://github.com/acdlite/flux-standard-action
interface BaseAction {
type: string;
}
interface Action<Payload> extends BaseAction {
payload?: Payload;
error?: boolean;
}
interface ActionMeta<Payload, Meta> extends Action<Payload> {
meta: Meta;
}
interface ReducerMap<State, Payload> {
[actionType: string]: Reducer<State, Payload> | ReducerNextThrow<State, Payload>;
}
interface ReducerMapMeta<State, Payload, Meta> {
[actionType: string]: Reducer<State, Payload> | ReducerNextThrow<State, Payload>;
}
interface ReducerNextThrow<State, Payload> {
next?(state: State, action: Action<Payload>): State;
throw?(state: State, action: Action<Payload>): State;
}
interface ReducerNextThrowMeta<State, Payload, Meta> {
next?(state: State, action: ActionMeta<Payload, Meta>): State;
throw?(state: State, action: ActionMeta<Payload, Meta>): State;
}
type ActionFunctions<Payload> = ActionFunction0<Action<Payload>> | ActionFunction1<any, Action<Payload>> | ActionFunction2<any, any, Action<Payload>> | ActionFunction3<any, any, any, Action<Payload>> | ActionFunction4<any, any, any, any, Action<Payload>> | ActionFunctionAny<Action<Payload>>;
type Reducer<State, Payload> = (state: State, action: Action<Payload>) => State;
type ReducerMeta<State, Payload, Meta> = (state: State, action: ActionMeta<Payload, Meta>) => State;
/** argument inferring borrowed from lodash definitions */
type ActionFunction0<R> = () => R;
type ActionFunction1<T1, R> = (t1: T1) => R;
type ActionFunction2<T1, T2, R> = (t1: T1, t2: T2) => R;
type ActionFunction3<T1, T2, T3, R> = (t1: T1, t2: T2, t3: T3) => R;
type ActionFunction4<T1, T2, T3, T4, R> = (t1: T1, t2: T2, t3: T3, t4: T4) => R;
type ActionFunctionAny<R> = (...args: any[]) => R;
export function createAction<Payload>(
actionType: string,
payloadCreator: ActionFunction0<Payload>
): ActionFunction0<Action<Payload>>;
export function createAction<Payload, Arg1>(
actionType: string,
payloadCreator: ActionFunction1<Arg1, Payload>
): ActionFunction1<Arg1, Action<Payload>>;
export function createAction<Payload, Arg1, Arg2>(
actionType: string,
payloadCreator: ActionFunction2<Arg1, Arg2, Payload>
): ActionFunction2<Arg1, Arg2, Action<Payload>>;
export function createAction<Payload, Arg1, Arg2, Arg3>(
actionType: string,
payloadCreator: ActionFunction3<Arg1, Arg2, Arg3, Payload>
): ActionFunction3<Arg1, Arg2, Arg3, Action<Payload>>;
export function createAction<Payload, Arg1, Arg2, Arg3, Arg4>(
actionType: string,
payloadCreator: ActionFunction4<Arg1, Arg2, Arg3, Arg4, Payload>
): ActionFunction4<Arg1, Arg2, Arg3, Arg4, Action<Payload>>;
export function createAction<Payload>(
actionType: string
): ActionFunctionAny<Action<Payload>>;
export function createAction<Payload, Meta>(
actionType: string,
payloadCreator: (...args: any[]) => Payload,
metaCreator: (...args: any[]) => Meta
): (...args: any[]) => ActionMeta<Payload, Meta>;
export function handleAction<State, Payload>(
actionType: string | ActionFunctions<Payload>,
reducer: Reducer<State, Payload> | ReducerNextThrow<State, Payload>,
initialState: State
): Reducer<State, Payload>;
export function handleAction<State, Payload, Meta>(
actionType: { toString(): string },
reducer: ReducerMeta<State, Payload, Meta> | ReducerNextThrowMeta<State, Payload, Meta>,
initialState: State
): Reducer<State, Payload>;
export function handleActions<StateAndPayload>(
reducerMap: ReducerMap<StateAndPayload, StateAndPayload>,
initialState: StateAndPayload
): Reducer<StateAndPayload, StateAndPayload>;
export function handleActions<State, Payload>(
reducerMap: ReducerMap<State, Payload>,
initialState: State
): Reducer<State, Payload>;
export function combineActions(
...actionTypes: Array<ActionFunctions<any>>
): Array<ActionFunctions<any>>;

View File

@ -1,4 +1,4 @@
import ReduxActions = require("redux-actions");
import * as ReduxActions from "redux-actions";
let state: number;
const minimalAction: ReduxActions.BaseAction = { type: 'INCREMENT' };

View File

@ -3,21 +3,18 @@
// Definitions by: Chad Burggraf <https://github.com/ChadBurggraf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = ReduxBatchedActions;
export as namespace ReduxBatchedActions;
import { Action, Reducer } from 'redux';
declare namespace ReduxBatchedActions {
/**
* Batching action creator that creates a higher-order
* action from an array of actions.
*/
export function batchActions<A extends Action>(actions: A[]): Action;
export as namespace ReduxBatchedActions;
/**
* Creates a higher-order reducer that enables batching
* actions for the given reducer.
*/
export function enableBatching<S>(reducer: Reducer<S>): Reducer<S>;
}
/**
* Batching action creator that creates a higher-order
* action from an array of actions.
*/
export function batchActions<A extends Action>(actions: A[]): Action;
/**
* Creates a higher-order reducer that enables batching
* actions for the given reducer.
*/
export function enableBatching<S>(reducer: Reducer<S>): Reducer<S>;

View File

@ -5,12 +5,8 @@
/// <reference types="node" />
declare namespace XsdSchemaValidator {
export function validateXML(xml: string|NodeJS.ReadableStream|{file: string}, pathToXsd: string, callback: (err: Error, result: {
valid: boolean;
messages: string[];
result: string;
}) => void): void;
}
export = XsdSchemaValidator;
export function validateXML(xml: string|NodeJS.ReadableStream|{file: string}, pathToXsd: string, callback: (err: Error, result: {
valid: boolean;
messages: string[];
result: string;
}) => void): void;