stage changes to index.d.ts

This commit is contained in:
zhengbli
2016-10-24 22:52:02 -07:00
parent 5a5ababe92
commit 2f4b18f28f
25 changed files with 539 additions and 372 deletions

View File

@@ -158,6 +158,7 @@ declare module 'angular' {
hideDelay(delay: number): T;
position(position: string): T;
parent(parent?: string | Element | JQuery): T; // default: root node
toastClass(toastClass: string): T;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {

View File

@@ -23,7 +23,9 @@ interface Context {
getRemainingTimeInMillis(): number;
// Functions for compatibility with earlier Node.js Runtime v0.10.42
log(message: string, object: any): void;
// For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods
done(error?: Error, result?: any): void;
fail(error: Error): void;
fail(message: string): void;
succeed(message: string): void;
succeed(object: any): void;

18
bunyan/index.d.ts vendored
View File

@@ -11,7 +11,7 @@ import { EventEmitter } from 'events';
declare class Logger extends EventEmitter {
constructor(options: LoggerOptions);
addStream(stream: Stream): void;
addSerializers(serializers: Serializers): void;
addSerializers(serializers:Serializers | StdSerializers):void;
child(options: LoggerOptions, simple?: boolean): Logger;
child(obj: Object, simple?: boolean): Logger;
reopenFileStreams(): void;
@@ -21,7 +21,7 @@ declare class Logger extends EventEmitter {
levels(name: number | string, value: number | string): void;
fields: any;
src: boolean;
src:boolean;
trace(error: Error, format?: any, ...params: any[]): void;
trace(buffer: Buffer, format?: any, ...params: any[]): void;
@@ -58,8 +58,18 @@ interface LoggerOptions {
src?: boolean;
}
interface Serializer {
(input:any): any;
}
interface Serializers {
[key: string]: (input: any) => string;
[key:string]: Serializer;
}
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
}
interface Stream {
@@ -72,7 +82,7 @@ interface Stream {
count?: number;
}
export declare var stdSerializers: Serializers;
export var stdSerializers:StdSerializers;
export declare var TRACE: number;
export declare var DEBUG: number;

49
byline/index.d.ts vendored
View File

@@ -7,31 +7,36 @@
import stream = require("stream");
declare function bl(): bl.LineStream;
declare function bl(stream: NodeJS.ReadableStream, options?: bl.LineStreamOptions): bl.LineStream;
export interface LineStreamOptions extends stream.TransformOptions {
keepEmptyLines?: boolean;
}
declare namespace bl {
export interface LineStream extends stream.Transform {
}
export interface LineStreamOptions extends stream.TransformOptions {
keepEmptyLines?: boolean;
}
export interface LineStreamCreatable extends LineStream {
new (options?: LineStreamOptions): LineStream
}
export interface LineStream extends stream.Transform {
}
//TODO is it possible to declare static factory functions without name (directly on the module)
//
// JS:
// // convinience API
// module.exports = function(readStream, options) {
// return module.exports.createStream(readStream, options);
// };
//
// TS:
// ():LineStream; // same as createStream():LineStream
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
export interface LineStreamCreatable extends LineStream {
new (options?: LineStreamOptions): LineStream
}
export declare function createStream(): LineStream;
export declare function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream;
//TODO is it possible to declare static factory functions without name (directly on the module)
//
// JS:
// // convinience API
// module.exports = function(readStream, options) {
// return module.exports.createStream(readStream, options);
// };
//
// TS:
// ():LineStream; // same as createStream():LineStream
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
export declare var LineStream: LineStreamCreatable;
export declare function createStream(): LineStream;
export declare function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream;
export declare var LineStream: LineStreamCreatable;
}

View File

@@ -134,7 +134,7 @@ export namespace types {
var LocalTime: LocalTimeStatic;
var Long: _Long;
var ResultSet: ResultSetStatic;
var ResultStream: ResultStreamStatic;
// var ResultStream: ResultStreamStatic;
var Row: RowStatic;
var TimeUuid: TimeUuidStatic;
var Tuple: TupleStatic;
@@ -365,7 +365,6 @@ export namespace types {
buffer: Buffer;
paused: boolean;
_read(): void;
_valve(readNext: Function): void;
add(chunk: Buffer): void;
}

88
electron/index.d.ts vendored
View File

@@ -423,6 +423,13 @@ declare namespace Electron {
* Note: This API is only available on macOS and Windows.
*/
setLoginItemSettings(settings: LoginItemSettings): void;
/**
* Set the about panel options. This will override the values defined in the app's .plist file.
* See the Apple docs for more details.
*
* Note: This API is only available on macOS.
*/
setAboutPanelOptions(options: AboutPanelOptions): void;
commandLine: CommandLine;
/**
* Note: This API is only available on macOS.
@@ -684,6 +691,29 @@ declare namespace Electron {
restoreState?: boolean;
}
interface AboutPanelOptions {
/**
* The app's name.
*/
applicationName?: string;
/**
* The app's version.
*/
applicationVersion?: string;
/**
* Copyright information.
*/
copyright?: string;
/**
* Credit information.
*/
credits?: string;
/**
* The app's build version number.
*/
version?: string;
}
// https://github.com/electron/electron/blob/master/docs/api/auto-updater.md
/**
@@ -3525,6 +3555,38 @@ declare namespace Electron {
// https://github.com/electron/electron/blob/master/docs/api/system-preferences.md
type SystemColor =
'3d-dark-shadow' | // Dark shadow for three-dimensional display elements.
'3d-face' | // Face color for three-dimensional display elements and for dialog box backgrounds.
'3d-highlight' | // Highlight color for three-dimensional display elements.
'3d-light' | // Light color for three-dimensional display elements.
'3d-shadow' | // Shadow color for three-dimensional display elements.
'active-border' | // Active window border.
'active-caption' | // Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.
'active-caption-gradient' | // Right side color in the color gradient of an active window's title bar.
'app-workspace' | // Background color of multiple document interface (MDI) applications.
'button-text' | // Text on push buttons.
'caption-text' | // Text in caption, size box, and scroll bar arrow box.
'desktop' | // Desktop background color.
'disabled-text' | // Grayed (disabled) text.
'highlight' | // Item(s) selected in a control.
'highlight-text' | // Text of item(s) selected in a control.
'hotlight' | // Color for a hyperlink or hot-tracked item.
'inactive-border' | // Inactive window border.
'inactive-caption' | // Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.
'inactive-caption-gradient' | // Right side color in the color gradient of an inactive window's title bar.
'inactive-caption-text' | // Color of text in an inactive caption.
'info-background' | // Background color for tooltip controls.
'info-text' | // Text color for tooltip controls.
'menu' | // Menu background.
'menu-highlight' | // The color used to highlight menu items when the menu appears as a flat menu.
'menubar' | // The background color for the menu bar when menus appear as flat menus.
'menu-text' | // Text in menus.
'scrollbar' | // Scroll bar gray area.
'window' | // Window background.
'window-frame' | // Window frame.
'window-text'; // Text in windows.
/**
* Get system preferences.
*/
@@ -3533,6 +3595,20 @@ declare namespace Electron {
* Note: This is only implemented on Windows.
*/
on(event: 'accent-color-changed', listener: (event: Event, newColor: string) => void): this;
/**
* Note: This is only implemented on Windows.
*/
on(event: 'color-changed', listener: (event: Event) => void): this;
/**
* Note: This is only implemented on Windows.
*/
on(event: 'inverted-color-scheme-changed', listener: (
event: Event,
/**
* @param invertedColorScheme true if an inverted color scheme, such as a high contrast theme, is being used, false otherwise.
*/
invertedColorScheme: boolean
) => void): this;
on(event: string, listener: Function): this;
/**
* @returns Whether the system is in Dark Mode.
@@ -3599,6 +3675,18 @@ declare namespace Electron {
* Note: This is only implemented on Windows.
*/
getAccentColor(): string;
/**
* @returns true if an inverted color scheme, such as a high contrast theme, is active, false otherwise.
*
* Note: This is only implemented on Windows.
*/
isInvertedColorScheme(): boolean;
/**
* @returns The system color setting in RGB hexadecimal form (#ABCDEF). See the Windows docs for more details.
*
* Note: This is only implemented on Windows.
*/
getColor(color: SystemColor): string;
}
// https://github.com/electron/electron/blob/master/docs/api/tray.md

27
enzyme/index.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for Enzyme v2.4.1
// Type definitions for Enzyme v2.5.1
// Project: https://github.com/airbnb/enzyme
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>, Ivo Stratev <https://github.com/NoHomey>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes } from "react";
@@ -101,11 +101,11 @@ interface CommonWrapper<P, S> {
is(selector: EnzymeSelector): boolean;
/**
* Returns whether or not the current node is empty.
*/
isEmpty(): boolean;
* Returns whether or not the current node is empty.
*/
isEmpty(): boolean;
/**
/**
* Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector.
* This method is effectively the negation or inverse of filter.
* @param selector
@@ -251,8 +251,9 @@ interface CommonWrapper<P, S> {
*
* NOTE: can only be called on a wrapper instance that is also the root instance.
* @param state
* @param [callback]
*/
setState(state: S): this;
setState(state: S, callback?: () => void): this;
/**
* A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test
@@ -263,9 +264,10 @@ interface CommonWrapper<P, S> {
* Returns itself.
*
* NOTE: can only be called on a wrapper instance that is also the root instance.
* @param state
* @param props
* @param [callback]
*/
setProps(props: P): this;
setProps(props: P, callback?: () => void): this;
/**
* A method that sets the context of the root component, and re-renders. Useful for when you are wanting to
@@ -423,6 +425,13 @@ export interface ShallowWrapper<P, S> extends CommonWrapper<P, S> {
childAt<P2, S2>(index: number): ShallowWrapper<P2, S2>;
/**
* Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result.
* NOTE: can only be called on wrapper of a single non-DOM component element node.
* @param [options]
*/
dive<P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2>;
/**
* Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the
* current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.
*

View File

@@ -8,12 +8,14 @@
import {ServerRequest, ServerResponse} from "http";
export interface Options {
message?: boolean | ((err: any, status: number) => string);
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
stacktrace?: boolean;
declare function finalHandler(req: ServerRequest, res: ServerResponse, options?: finalHandler.Options): (err: any) => void;
declare namespace finalHandler {
export interface Options {
message?: boolean|((err: any, status: number) => string);
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
stacktrace?: boolean;
}
}
declare function finalHandler(req: ServerRequest, res: ServerResponse, options?: Options): (err: any) => void;
export default finalHandler;
export = finalHandler;

17
fs-extra/index.d.ts vendored
View File

@@ -8,7 +8,6 @@
/// <reference types="node" />
import * as stream from 'stream';
export * from "fs";
export declare function copy(src: string, dest: string, callback?: (err: Error) => void): void;
@@ -19,9 +18,6 @@ export declare function copySync(src: string, dest: string): void;
export declare function copySync(src: string, dest: string, filter: CopyFilter): void;
export declare function copySync(src: string, dest: string, options: CopyOptions): void;
export declare function move(src: string, dest: string, callback?: (err: Error) => void): void;
export declare function move(src: string, dest: string, options: MoveOptions, callback?: (err: Error) => void): void;
export declare function createFile(file: string, callback?: (err: Error) => void): void;
export declare function createFileSync(file: string): void;
@@ -73,8 +69,8 @@ export declare function ensureSymlinkSync(path: string): void;
export declare function emptyDir(path: string, callback?: (err: Error) => void): void;
export declare function emptyDirSync(path: string): boolean;
export interface CopyFilterFunction {
export interface CopyFilterFunction {
(src: string): boolean
}
@@ -87,10 +83,11 @@ export interface CopyOptions {
filter?: CopyFilter
recursive?: boolean
}
export interface MoveOptions {
clobber?: boolean;
limit?: number;
}
export interface MoveOptions {
clobber? : boolean;
limit?: number;
}
export interface OpenOptions {
encoding?: string;

View File

@@ -136,13 +136,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
eventAfterAllRender?: (view: ViewObject) => void;
eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void;
//scheduler options
resourceAreaWidth?: number;
schedulerLicenseKey?: string;
customButtons?: any;
resourceLabelText?: any;
resourceColumns?: any;
displayEventTime?: any;
//scheduler options
}
/**

52
hapi/index.d.ts vendored
View File

@@ -73,6 +73,37 @@ export interface ICatBoxCacheOptions {
/** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */
shared?: boolean;
}
/** policy configuration for the "CatBox" module and server method options. */
export interface ICatBoxCachePolicyOptions {
/** the cache name configured in server.cache. Defaults to the default cache. */
cache?: string;
/** string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. When called within a server method, defaults to '#name' where 'name' is the server method name. Required when called outside of a plugin. */
segment?: string;
/** if true, allows multiple cache provisions to share the same segment. Default to false. */
shared?: boolean;
/** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */
expiresIn?: number;
/** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. */
expiresAt?: number;
/** a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. */
generateFunc?: Function;
/** number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. */
staleIn?: number;
/** number of milliseconds to wait before checking if an item is stale. */
staleTimeout?: number;
/** number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. Required if generateFunc is present. Set to false to disable timeouts which may cause all get() requests to get stuck forever. */
generateTimeout?: number;
/** if true, an error or timeout in the generateFunc causes the stale value to be evicted from the cache. Defaults to true */
dropOnError?: boolean;
/** if false, an upstream cache read error will stop the cache.get() method from calling the generate function and will instead pass back the cache error. Defaults to true. */
generateOnReadError?: boolean;
/** if false, an upstream cache write error when calling cache.get() will be passed back with the generated value when calling. Defaults to true. */
generateIgnoreWriteError?: boolean;
/** number of milliseconds while generateFunc call is in progress for a given id, before a subsequent generateFunc call is allowed. Defaults to 0 (no blocking of concurrent generateFunc calls beyond staleTimeout). */
pendingGenerateTimeout?: number;
}
/** Any connections configuration server defaults can be included to override and customize the individual connection. */
export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults {
@@ -103,6 +134,8 @@ export interface IServerConnectionOptions extends IConnectionConfigurationServer
export interface IConnectionConfigurationServerDefaults {
/** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */
app?: any;
/** if false, response content encoding is disabled. Defaults to true */
compression?: boolean;
/** connection load limits configuration where: */
load?: {
/** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */
@@ -328,11 +361,12 @@ export interface IStrictReply<T> extends IReplyMethods {
export interface ISessionHandler {
(request: Request, reply: IReply): void;
}
}
export interface IStrictSessionHandler {
export interface IStrictSessionHandler {
<T>(request: Request, reply: IStrictReply<T>): void;
}
export interface IRequestHandler<T> {
(request: Request): T;
}
@@ -496,7 +530,7 @@ export interface IRouteAdditionalConfigurationOptions {
};
/** an alternative location for the route handler option. */
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** an optional unique identifier used to look up the route using server.lookup(). */
id?: number;
/** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */
@@ -895,7 +929,7 @@ export interface IRouteConfiguration {
/** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/
vhost?: string;
/** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** - additional route options.*/
config?: IRouteAdditionalConfigurationOptions;
}
@@ -1106,7 +1140,7 @@ export interface IServerMethod {
generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/
export interface IServerMethodOptions {
bind?: any;
cache?: ICatBoxCacheOptions;
cache?: ICatBoxCachePolicyOptions;
callback?: boolean;
generateKey?(args: any[]): string;
}
@@ -1873,9 +1907,9 @@ export class Server extends Events.EventEmitter {
}
}
});*/
strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string): void;
strategy(name: string, scheme: string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string): void;
strategy(name: string, scheme: string, options?:any): void;
/** server.auth.test(strategy, request, next)
Tests a request against an authentication strategy where:
@@ -1942,7 +1976,7 @@ export class Server extends Events.EventEmitter {
// value === { capital: 'oslo' };
});
});*/
cache(options: ICatBoxCacheOptions): void;
cache(options: ICatBoxCachePolicyOptions): void;
/** server.connection([options])
Adds an incoming server connection

129
http-errors/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for http-errors v1.3.1
// Type definitions for http-errors v1.5.0
// Project: https://github.com/jshttp/http-errors
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -12,6 +12,8 @@ declare namespace createHttpError {
statusCode: number;
expose: boolean;
}
type HttpErrorConstructor = new(msg?: string) => HttpError;
interface CreateHttpError {
// See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674
@@ -19,68 +21,69 @@ declare namespace createHttpError {
(...args: Array<Error | string | number | Object>): HttpError;
Continue: new () => HttpError;
SwitchingProtocols: new () => HttpError;
Processing: new () => HttpError;
OK: new () => HttpError;
Created: new () => HttpError;
Accepted: new () => HttpError;
NonAuthoritativeInformation: new () => HttpError;
NoContent: new () => HttpError;
ResetContent: new () => HttpError;
PartialContent: new () => HttpError;
MultiStatus: new () => HttpError;
AlreadyReported: new () => HttpError;
IMUsed: new () => HttpError;
MultipleChoices: new () => HttpError;
MovedPermanently: new () => HttpError;
Found: new () => HttpError;
SeeOther: new () => HttpError;
NotModified: new () => HttpError;
UseProxy: new () => HttpError;
Unused: new () => HttpError;
TemporaryRedirect: new () => HttpError;
PermanentRedirect: new () => HttpError;
BadRequest: new () => HttpError;
Unauthorized: new () => HttpError;
PaymentRequired: new () => HttpError;
Forbidden: new () => HttpError;
NotFound: new () => HttpError;
MethodNotAllowed: new () => HttpError;
NotAcceptable: new () => HttpError;
ProxyAuthenticationRequired: new () => HttpError;
RequestTimeout: new () => HttpError;
Conflict: new () => HttpError;
Gone: new () => HttpError;
LengthRequired: new () => HttpError;
PreconditionFailed: new () => HttpError;
PayloadTooLarge: new () => HttpError;
URITooLong: new () => HttpError;
UnsupportedMediaType: new () => HttpError;
RangeNotSatisfiable: new () => HttpError;
ExpectationFailed: new () => HttpError;
ImATeapot: new () => HttpError;
UnprocessableEntity: new () => HttpError;
Locked: new () => HttpError;
FailedDependency: new () => HttpError;
UnorderedCollection: new () => HttpError;
UpgradeRequired: new () => HttpError;
PreconditionRequired: new () => HttpError;
TooManyRequests: new () => HttpError;
RequestHeaderFieldsTooLarge: new () => HttpError;
UnavailableForLegalReasons: new () => HttpError;
InternalServerError: new () => HttpError;
NotImplemented: new () => HttpError;
BadGateway: new () => HttpError;
ServiceUnavailable: new () => HttpError;
GatewayTimeout: new () => HttpError;
HTTPVersionNotSupported: new () => HttpError;
VariantAlsoNegotiates: new () => HttpError;
InsufficientStorage: new () => HttpError;
LoopDetected: new () => HttpError;
BandwidthLimitExceeded: new () => HttpError;
NotExtended: new () => HttpError;
NetworkAuthenticationRequired: new () => HttpError;
Continue: HttpErrorConstructor;
SwitchingProtocols: HttpErrorConstructor;
Processing: HttpErrorConstructor;
OK: HttpErrorConstructor;
Created: HttpErrorConstructor;
Accepted: HttpErrorConstructor;
NonAuthoritativeInformation: HttpErrorConstructor;
NoContent: HttpErrorConstructor;
ResetContent: HttpErrorConstructor;
PartialContent: HttpErrorConstructor;
MultiStatus: HttpErrorConstructor;
AlreadyReported: HttpErrorConstructor;
IMUsed: HttpErrorConstructor;
MultipleChoices: HttpErrorConstructor;
MovedPermanently: HttpErrorConstructor;
Found: HttpErrorConstructor;
SeeOther: HttpErrorConstructor;
NotModified: HttpErrorConstructor;
UseProxy: HttpErrorConstructor;
Unused: HttpErrorConstructor;
TemporaryRedirect: HttpErrorConstructor;
PermanentRedirect: HttpErrorConstructor;
BadRequest: HttpErrorConstructor;
Unauthorized: HttpErrorConstructor;
PaymentRequired: HttpErrorConstructor;
Forbidden: HttpErrorConstructor;
NotFound: HttpErrorConstructor;
MethodNotAllowed: HttpErrorConstructor;
NotAcceptable: HttpErrorConstructor;
ProxyAuthenticationRequired: HttpErrorConstructor;
RequestTimeout: HttpErrorConstructor;
Conflict: HttpErrorConstructor;
Gone: HttpErrorConstructor;
LengthRequired: HttpErrorConstructor;
PreconditionFailed: HttpErrorConstructor;
PayloadTooLarge: HttpErrorConstructor;
URITooLong: HttpErrorConstructor;
UnsupportedMediaType: HttpErrorConstructor;
RangeNotSatisfiable: HttpErrorConstructor;
ExpectationFailed: HttpErrorConstructor;
ImATeapot: HttpErrorConstructor;
MisdirectedRequest: HttpErrorConstructor;
UnprocessableEntity: HttpErrorConstructor;
Locked: HttpErrorConstructor;
FailedDependency: HttpErrorConstructor;
UnorderedCollection: HttpErrorConstructor;
UpgradeRequired: HttpErrorConstructor;
PreconditionRequired: HttpErrorConstructor;
TooManyRequests: HttpErrorConstructor;
RequestHeaderFieldsTooLarge: HttpErrorConstructor;
UnavailableForLegalReasons: HttpErrorConstructor;
InternalServerError: HttpErrorConstructor;
NotImplemented: HttpErrorConstructor;
BadGateway: HttpErrorConstructor;
ServiceUnavailable: HttpErrorConstructor;
GatewayTimeout: HttpErrorConstructor;
HTTPVersionNotSupported: HttpErrorConstructor;
VariantAlsoNegotiates: HttpErrorConstructor;
InsufficientStorage: HttpErrorConstructor;
LoopDetected: HttpErrorConstructor;
BandwidthLimitExceeded: HttpErrorConstructor;
NotExtended: HttpErrorConstructor;
NetworkAuthenticationRequired: HttpErrorConstructor;
}
}

2
inquirer/index.d.ts vendored
View File

@@ -110,7 +110,7 @@ declare namespace inquirer {
* A key/value hash containing the client answers in each prompt.
*/
interface Answers {
[key: string]: string | boolean;
[key: string]: any;
}
namespace ui {

View File

@@ -237,6 +237,7 @@ declare module 'angular' {
template: string;
controller?: string| any[] | any;
controllerAs?: string;
bindToController?: boolean;
/**
* Scope object that will be passed to dialog. If you use controller with separate $scope service this object will be passed to $scope.$parent param.

View File

@@ -1,4 +1,4 @@
// Type definitions for Node Sass
// Type definitions for Node Sass v3.10.1
// Project: https://github.com/sass/node-sass
// Definitions by: Asana <https://asana.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -22,13 +22,13 @@ interface Options {
linefeed?: string;
omitSourceMapUrl?: boolean;
outFile?: string;
outputStyle?: string;
outputStyle?: "compact" | "compressed" | "expanded" | "nested";
precision?: number;
sourceComments?: boolean;
sourceMap?: boolean | string;
sourceMapContents?: boolean;
sourceMapEmbed?: boolean;
sourceMapRoot?: boolean;
sourceMapRoot?: string;
}
interface SassError extends Error {

View File

@@ -11,7 +11,7 @@ import { EventEmitter } from 'events';
* The callback executed by a Job
*/
export interface JobCallback {
(): void;
():void;
}
/**
@@ -23,7 +23,7 @@ export class Job extends EventEmitter {
/**
* This Job's name. read-only.
*/
name: string;
name:string;
/**
* Use the function scheduleJob() to create new Job objects.
@@ -34,7 +34,7 @@ export class Job extends EventEmitter {
* @param {JobCallback|Function} job either this Job's callback or an optional callback function
* @param {Function} callback optional callback that is executed right before the JobCallback
*/
constructor(name: string | JobCallback, job?: JobCallback | Function, callback?: Function);
constructor(name: string|JobCallback, job?: JobCallback|Function, callback?: Function);
/**
* Adds an Invocation to this job. For internal use.
@@ -42,7 +42,7 @@ export class Job extends EventEmitter {
* @param {Invocation} invokation
* @return {boolean} whether the invocation could be added
*/
trackInvocation(invokation: Invocation): boolean;
trackInvocation(invokation:Invocation):boolean;
/**
* removes an Invocation from this Job's tracking list. For internal use.
@@ -50,69 +50,69 @@ export class Job extends EventEmitter {
* @param invocation {Invocation}
* @return boolean whether the invocation was successful. Removing an Invocation that doesn't exist, returns false.
*/
stopTrackingInvocation(invocation: Invocation): boolean;
stopTrackingInvocation(invocation:Invocation):boolean;
/**
* @internal
* @return {number} the number of currently running instances of this Job.
*/
triggeredJobs(): number;
triggeredJobs():number;
/**
* set the number of currently running Jobs.
* @internal
* @param triggeredJobs
*/
setTriggeredJobs(triggeredJobs: number): void;
setTriggeredJobs(triggeredJobs:number):void;
/**
* cancel all pending Invocations of this Job.
* @param reschedule {boolean} whether to reschedule the canceled Invocations.
*/
cancel(reschedule?: boolean): boolean;
cancel(reschedule?:boolean):boolean;
/**
* cancel the next Invocation of this Job.
* @param reschedule {boolean} whether to reschedule the canceled Invocation.
* @return {boolean} whether cancelation was successful
*/
cancelNext(reschedule?: boolean): boolean;
cancelNext(reschedule?:boolean):boolean;
/**
* Changes the scheduling information for this Job.
* @param spec {RecurrenceRule|string|number} the
* @return {boolean} whether the reschedule was successful
*/
reschedule(spec: RecurrenceRule | string | number): boolean;
reschedule(spec:RecurrenceRule|string|number):boolean;
/**
* Returns the Date on which this Job will be run next.
* @return {Date}
*/
nextInvocation(): Date;
nextInvocation():Date;
/**
* @return Invocation[] a list of all pending Invocations
*/
pendingInvocations(): Invocation[];
pendingInvocations():Invocation[];
/**
* run this Job immediately.
*/
invoke(): void;
invoke():void;
/**
* schedule this Job to be run on the specified date.
* @param date {Date}
*/
runOnDate(date: Date): void;
runOnDate(date:Date): void;
/**
* set scheduling information
* @param {Date|string|number} date
* @public
*/
schedule(date: Date | string | number): boolean;
schedule(date: Date|string|number): boolean;
}
/**
@@ -140,6 +140,9 @@ export class Range {
contains(value: number): boolean;
}
type Recurrence = number | Range | string;
type RecurrenceSegment = Recurrence | Recurrence[];
/**
* Recurrence rules.
*/
@@ -148,67 +151,67 @@ export class RecurrenceRule {
* Day of the month.
*
* @public
* @type {number}
* @type {RecurrenceSegment}
*/
date: number;
date: RecurrenceSegment;
/**
* Day of the week.
*
* @public
* @type {number|Array<number|Range>}
* @type {RecurrenceSegment}
*/
dayOfWeek: number | Array<number | Range>;
dayOfWeek: RecurrenceSegment;
/**
* Hour.
*
* @public
* @type {number}
* @type {RecurrenceSegment}
*/
hour: number;
hour: RecurrenceSegment;
/**
* Minute.
*
* @public
* @type {number}
* @type {RecurrenceSegment}
*/
minute: number;
minute: RecurrenceSegment;
/**
* Month.
*
* @public
* @type {number}
* @type {RecurrenceSegment}
*/
month: number;
month: RecurrenceSegment;
/**
* Second.
*
* @public
* @type {number}
* @type {RecurrenceSegment}
*/
second: number;
second: RecurrenceSegment;
/**
* Year.
*
* @public
* @type {number}
* @type {RecurrenceSegment}
*/
year: number;
year: RecurrenceSegment;
constructor(year?: number,
month?: number,
date?: number,
dayOfWeek?: number | Array<number | Range>,
hour?: number,
minute?: number,
second?: number);
constructor(year?: RecurrenceSegment,
month?: RecurrenceSegment,
date?: RecurrenceSegment,
dayOfWeek?: RecurrenceSegment,
hour?: RecurrenceSegment,
minute?: RecurrenceSegment,
second?: RecurrenceSegment);
nextInvocationDate(base: Date): Date;
nextInvocationDate(base:Date):Date;
}
/**
@@ -267,7 +270,7 @@ export class Invocation {
* @param {RecurrenceRule|Date|string} rule either the scheduling info or the JobCallback
* @param {JobCallback} callback The callback to be executed on each invocation.
*/
export function scheduleJob(name: string | RecurrenceRule | Date, rule: RecurrenceRule | Date | string | JobCallback, callback?: JobCallback): Job;
export function scheduleJob(name:string|RecurrenceRule|Date, rule: RecurrenceRule|Date|string|JobCallback, callback?: JobCallback): Job;
/**
* Changes the timing of a Job, canceling all pending invocations.
@@ -276,12 +279,12 @@ export function scheduleJob(name: string | RecurrenceRule | Date, rule: Recurren
* @param spec {JobCallback} the new timing for this Job
* @return {Job} if the job could be rescheduled, {null} otherwise.
*/
export function rescheduleJob(job: Job | string, spec: RecurrenceRule | Date | string): Job;
export function rescheduleJob(job:Job|string, spec:RecurrenceRule|Date|string):Job;
/**
* Dictionary of all Jobs, accessible by name.
*/
export let scheduledJobs: { [jobName: string]: Job };
export let scheduledJobs:{[jobName:string]:Job};
/**
* Cancels the job.
@@ -289,4 +292,4 @@ export let scheduledJobs: { [jobName: string]: Job };
* @param {Job} job The job.
* @returns {boolean} {true} if the job has been cancelled with success, otherwise, {false}.
*/
export function cancelJob(job: Job | string): boolean;
export function cancelJob(job: Job|string): boolean;

View File

@@ -10,4 +10,5 @@ declare function objectAssign<T, U, V, W>(target: T, source1: U, source2: V, sou
declare function objectAssign<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q;
declare function objectAssign<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R;
declare function objectAssign(target: any, ...sources: any[]): any;
declare namespace objectAssign { }
export = objectAssign;

29
ora/index.d.ts vendored
View File

@@ -1,24 +1,35 @@
// Type definitions for ora
// Type definitions for ora v0.3.0
// Project: https://github.com/sindresorhus/ora
// Definitions by: Basarat Ali Syed <https://github.com/basarat/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray';
type Text = string;
interface Options {
text?: Text;
spinner?: string | { interval?: number; frames: string[]; }
spinner?: string | Spinner;
color?: Color;
stream?: any;
interval?: number;
stream?: NodeJS.WritableStream;
enabled?: boolean;
}
interface Spinner {
interval?: number;
frames: string[];
}
interface Instance {
start(): void;
stop(): void;
clear(): void;
frame(): void;
render(): void;
text: Text;
start(): Instance;
stop(): Instance;
succeed(): Instance;
fail(): Instance;
stopAndPersist(symbol?: string): Instance;
clear(): Instance;
render(): Instance;
frame(): Instance;
text: string;
color: Color;
}
declare function ora(options: Options | Text): Instance;

299
parsimmon/index.d.ts vendored
View File

@@ -1,6 +1,6 @@
// Type definitions for Parsimmon 0.9.2
// Project: https://github.com/jneen/parsimmon
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Mizunashi Mana <https://github.com/mizunashi-mana>
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Mizunashi Mana <https://github.com/mizunashi-mana>, Boris Cherny <https://github.com/bcherny>, Benny van Reeven <https://github.com/bvanreeven>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TODO convert to generics
@@ -10,9 +10,18 @@ declare namespace Parsimmon {
export type StreamType = string;
export interface Index {
/** zero-based character offset */
offset: number;
/** one-based line offset */
line: number;
/** one-based column offset */
column: number;
}
export interface Mark<T> {
start: number;
end: number;
start: Index;
end: Index;
value: T;
}
@@ -20,236 +29,238 @@ declare namespace Parsimmon {
status: boolean;
value?: T;
expected?: string;
index?: number;
index?: Index;
}
export interface Parser<T> {
/**
* parse the string
/**
* parse the string
*/
parse(input: string): Result<T>;
/**
* returns a new parser which tries parser, and if it fails uses otherParser.
/**
* returns a new parser which tries parser, and if it fails uses otherParser.
*/
or(otherParser: Parser<T>): Parser<T>;
or<U>(otherParser: Parser<U>): Parser<any>;
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser, which
* will be tried next
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser, which
* will be tried next
*/
chain<U>(next: (result: T) => Parser<U>): Parser<U>;
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser.
/**
* returns a new parser which tries parser, and on success calls the given function
* with the result of the parse, which is expected to return another parser.
*/
then<U>(call: (result: T) => Parser<U>): Parser<U>;
/**
* expects anotherParser to follow parser, and yields the result of anotherParser.
* NB: the result of parser here is ignored.
/**
* expects anotherParser to follow parser, and yields the result of anotherParser.
* NB: the result of parser here is ignored.
*/
then<U>(anotherParser: Parser<U>): Parser<U>;
/**
* transforms the output of parser with the given function.
/**
* transforms the output of parser with the given function.
*/
map<U>(call: (result: T) => U): Parser<U>;
/**
* expects otherParser after parser, but preserves the yield value of parser.
/**
* expects otherParser after parser, but preserves the yield value of parser.
*/
skip<U>(otherParser: Parser<U>): Parser<T>;
/**
* returns a new parser with the same behavior, but which yields aResult.
/**
* returns a new parser with the same behavior, but which yields aResult.
*/
result<U>(aResult: U): Parser<U>;
/**
* expects parser zero or more times, and yields an array of the results.
/**
* expects parser zero or more times, and yields an array of the results.
*/
many(): Parser<T[]>;
/**
* expects parser exactly n times, and yields an array of the results.
/**
* expects parser exactly n times, and yields an array of the results.
*/
times(n: number): Parser<T[]>;
/**
* expects parser between min and max times, and yields an array of the results.
/**
* expects parser between min and max times, and yields an array of the results.
*/
times(min: number, max: number): Parser<T[]>;
/**
* expects parser at most n times. Yields an array of the results.
/**
* expects parser at most n times. Yields an array of the results.
*/
atMost(n: number): Parser<T[]>;
/**
* expects parser at least n times. Yields an array of the results.
/**
* expects parser at least n times. Yields an array of the results.
*/
atLeast(n: number): Parser<T[]>;
/**
* returns a new parser whose failure message is the passed description.
/**
* returns a new parser whose failure message is the passed description.
*/
mark(): Parser<Mark<T>>;
/**
* Returns a new parser whose failure message is description.
* For example, string('x').desc('the letter x') will indicate that 'the letter x' was expected.
*/
/**
* Returns a new parser whose failure message is description.
* For example, string('x').desc('the letter x') will indicate that 'the letter x' was expected.
*/
desc(description: string): Parser<T>;
}
/**
* Returns true if obj is a Parsimmon parser, otherwise false.
*/
export function isParser(obj: any): boolean;
/**
* is a parser that expects to find "my-string", and will yield the same.
*/
export function string(mystring: string): Parser<string>;
/**
* Returns a parser that looks for exactly one character from string, and yields that character.
*/
export function oneOf(string: string): Parser<string>;
/**
* Returns true if obj is a Parsimmon parser, otherwise false.
*/
export function isParser(obj: any): boolean;
/**
* Returns a parser that looks for exactly one character NOT from string, and yields that character.
/**
* is a parser that expects to find "my-string", and will yield the same.
*/
export function noneOf(string: string): Parser<string>;
export function string(string: string): Parser<string>;
/**
* Returns a parser that looks for a match to the regexp and yields the given match group
* (defaulting to the entire match). The regexp will always match starting at the current
* parse location. The regexp may only use the following flags: imu. Any other flag will
* result in an error being thrown.
/**
* Returns a parser that looks for exactly one character from string, and yields that character.
*/
export function oneOf(string: string): Parser<string>;
/**
* Returns a parser that looks for exactly one character NOT from string, and yields that character.
*/
export function noneOf(string: string): Parser<string>;
/**
* Returns a parser that looks for a match to the regexp and yields the given match group
* (defaulting to the entire match). The regexp will always match starting at the current
* parse location. The regexp may only use the following flags: imu. Any other flag will
* result in an error being thrown.
*/
export function regexp(myregex: RegExp, group?: number): Parser<string>;
export function regexp(myregex: RegExp, group?: number): Parser<string>;
/**
* This was the original name for Parsimmon.regexp, but now it is just an alias.
*/
export function regex(myregex: RegExp, group?: number): Parser<string>;
/**
* This was the original name for Parsimmon.regexp, but now it is just an alias.
*/
export function regex(myregex: RegExp, group?: number): Parser<string>;
/**
* Returns a parser that doesn't consume any of the string, and yields result.
/**
* Returns a parser that doesn't consume any of the string, and yields result.
*/
export function succeed<U>(result: U): Parser<U>;
/**
* This is an alias for Parsimmon.succeed(result).
*/
export function of<U>(result: U): Parser<U>;
/**
* This is an alias for Parsimmon.succeed(result).
*/
export function of<U>(result: U): Parser<U>;
/**
* accepts a variable number of parsers that it expects to find in order, yielding an array of the results.
/**
* accepts a variable number of parsers that it expects to find in order, yielding an array of the results.
*/
export function seq<T>(p1: Parser<T>): Parser<[T]>;
export function seq<T, U>(p1: Parser<T>, p2: Parser<U>): Parser<[T, U]>;
export function seq<T, U, V>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>): Parser<[T, U, V]>;
export function seq<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>): Parser<[T, U, V, W]>;
export function seq<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>): Parser<[T, U, V, W, X]>;
export function seq<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>): Parser<[T, U, V, W, X, Y]>;
export function seq<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>): Parser<[T, U, V, W, X, Y, Z]>;
export function seq<T>(...parsers: Parser<T>[]): Parser<T[]>;
export function seq<T>(p1: Parser<T>): Parser<[T]>;
export function seq<T, U>(p1: Parser<T>, p2: Parser<U>): Parser<[T, U]>;
export function seq<T, U, V>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>): Parser<[T, U, V]>;
export function seq<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>): Parser<[T, U, V, W]>;
export function seq<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>): Parser<[T, U, V, W, X]>;
export function seq<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>): Parser<[T, U, V, W, X, Y]>;
export function seq<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, p7: Parser<Z>): Parser<[T, U, V, W, X, Y, Z]>;
export function seq<T>(...parsers: Parser<T>[]): Parser<T[]>;
export function seq(...parsers: Parser<any>[]): Parser<any[]>;
/**
* Takes the string passed to parser.parse(string) and the error returned from
* parser.parse(string) and turns it into a human readable error message string.
* Note that there are certainly better ways to format errors, so feel free to write your own.
*/
export function formatError<T>(string: string, error: Result<T>): string;
/**
* Takes the string passed to parser.parse(string) and the error returned from
* parser.parse(string) and turns it into a human readable error message string.
* Note that there are certainly better ways to format errors, so feel free to write your own.
*/
export function formatError<T>(string: string, error: Result<T>): string;
/**
* Matches all parsers sequentially, and passes their results as the arguments to a function.
* Similar to calling Parsimmon.seq and then .map, but the values are not put in an array.
*/
export function seqMap<T, U>(p1: Parser<T>, cb: (a1: T) => U): Parser<U>;
export function seqMap<T, U, V>(p1: Parser<T>, p2: Parser<U>, cb: (a1: T, a2: U) => V): Parser<V>;
export function seqMap<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, cb: (a1: T, a2: U, a3: V) => W): Parser<W>;
export function seqMap<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser<X>;
export function seqMap<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser<Y>;
export function seqMap<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser<Z>;
/**
* Matches all parsers sequentially, and passes their results as the arguments to a function.
* Similar to calling Parsimmon.seq and then .map, but the values are not put in an array.
*/
export function seqMap<T, U>(p1: Parser<T>, cb: (a1: T) => U): Parser<U>;
export function seqMap<T, U, V>(p1: Parser<T>, p2: Parser<U>, cb: (a1: T, a2: U) => V): Parser<V>;
export function seqMap<T, U, V, W>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, cb: (a1: T, a2: U, a3: V) => W): Parser<W>;
export function seqMap<T, U, V, W, X>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser<X>;
export function seqMap<T, U, V, W, X, Y>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser<Y>;
export function seqMap<T, U, V, W, X, Y, Z>(p1: Parser<T>, p2: Parser<U>, p3: Parser<V>, p4: Parser<W>, p5: Parser<X>, p6: Parser<Y>, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser<Z>;
export type SuccessFunctionType<U> = (index: number, result: U) => Result<U>;
export type FailureFunctionType<U> = (index: number, msg: string) => Result<U>;
export type ParseFunctionType<U> = (stream: StreamType, index: number) => Result<U>;
/**
* allows to add custom primitive parsers.
/**
* allows to add custom primitive parsers.
*/
export function custom<U>(parsingFunction: (success: SuccessFunctionType<U>, failure: FailureFunctionType<U>) => ParseFunctionType<U>): Parser<U>;
/**
* accepts a variable number of parsers, and yields the value of the first one that succeeds,
* backtracking in between.
/**
* accepts a variable number of parsers, and yields the value of the first one that succeeds,
* backtracking in between.
*/
export function alt<U>(...parsers: Parser<U>[]): Parser<U>;
export function alt(...parsers: Parser<any>[]): Parser<any>;
/**
* Accepts two parsers, and expects zero or more matches for content, separated by separator, yielding an array.
*/
export function sepBy<T>(content: Parser<T>, separator: Parser<T>): Parser<T>
/**
* Accepts two parsers, and expects zero or more matches for content, separated by separator, yielding an array.
*/
export function sepBy<T>(content: Parser<T>, separator: Parser<T>): Parser<T>
/**
* This is the same as Parsimmon.sepBy, but matches the content parser at least once.
*/
export function sepBy1<T>(content: Parser<T>, separator: Parser<T>): Parser<T>
/**
* This is the same as Parsimmon.sepBy, but matches the content parser at least once.
*/
export function sepBy1<T>(content: Parser<T>, separator: Parser<T>): Parser<T>
/**
* accepts a function that returns a parser, which is evaluated the first time the parser is used.
* This is useful for referencing parsers that haven't yet been defined.
/**
* accepts a function that returns a parser, which is evaluated the first time the parser is used.
* This is useful for referencing parsers that haven't yet been defined.
*/
export function lazy<U>(f: () => Parser<U>): Parser<U>;
export function lazy<U>(description: string, f: () => Parser<U>): Parser<U>;
/**
* fail paring with a message
/**
* fail paring with a message
*/
export function fail(message: string): Parser<void>;
export function fail<U>(message: string): Parser<U>;
/**
* is equivalent to Parsimmon.regex(/[a-z]/i)
/**
* is equivalent to Parsimmon.regex(/[a-z]/i)
*/
export var letter: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[a-z]*`/i)
/**
* is equivalent to Parsimmon.regex(/[a-z]*`/i)
*/
export var letters: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]/)
/**
* is equivalent to Parsimmon.regex(/[0-9]/)
*/
export var digit: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/[0-9]*`/)
/**
* is equivalent to Parsimmon.regex(/[0-9]*`/)
*/
export var digits: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s+/)
/**
* is equivalent to Parsimmon.regex(/\s+/)
*/
export var whitespace: Parser<string>;
/**
* is equivalent to Parsimmon.regex(/\s*`/)
/**
* is equivalent to Parsimmon.regex(/\s*`/)
*/
export var optWhitespace: Parser<string>;
/**
* consumes and yields the next character of the stream.
/**
* consumes and yields the next character of the stream.
*/
export var any: Parser<string>;
/**
* consumes and yields the entire remainder of the stream.
/**
* consumes and yields the entire remainder of the stream.
*/
export var all: Parser<string>;
/**
* expects the end of the stream.
/**
* expects the end of the stream.
*/
export var eof: Parser<void>;
/**
* is a parser that yields the current index of the parse.
/**
* is a parser that yields the current index of the parse.
*/
export var index: Parser<number>;
/**
* Returns a parser that yield a single character if it passes the predicate
*/
export function test(predicate: (char: string) => boolean): Parser<string>;
/**
* Returns a parser yield a string containing all the next characters that pass the predicate
*/
export function takeWhile(predicate: (char: string) => boolean): Parser<string>;
export var index: Parser<Index>;
/**
* Returns a parser that yield a single character if it passes the predicate
*/
export function test(predicate: (char: string) => boolean): Parser<string>;
/**
* Returns a parser yield a string containing all the next characters that pass the predicate
*/
export function takeWhile(predicate: (char: string) => boolean): Parser<string>;
}
export = Parsimmon;

View File

@@ -1,5 +1,4 @@
/// <reference path="pg-types.d.ts" />
/// <reference path="../moment/moment.d.ts" />
/// <reference types="moment" />
import * as types from "pg-types";
types.getTypeParser(1184, 'text');

View File

@@ -1,23 +0,0 @@
// Type definitions for pg-types 1.11.0
// Project: https://github.com/brianc/node-pg-types
// Definitions by: James Bracy <https://github.com/waratuman>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "pg-types" {
interface TypeParser {
(value: any): any;
}
export function getTypeParser(oid: number, format: string): TypeParser;
export function setTypeParser(oid: number, format: string, parseFn: TypeParser): void;
export function setTypeParser(oid: number, parseFn: TypeParser): void;
export namespace arrayParser {
export function create(source: any, transform: TypeParser): { parse: () => any[] };
}
}

24
pg/index.d.ts vendored
View File

@@ -4,10 +4,12 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/// <reference types="pg-types" />
import events = require("events");
import stream = require("stream");
import pgTypes = require("pg-types");
export declare function connect(connection: string, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void;
export declare function connect(config: ClientConfig, callback: (err: Error, client: Client, done: (err?: any) => void) => void): void;
@@ -34,13 +36,13 @@ export interface ClientConfig extends ConnectionConfig {
}
export interface PoolConfig extends ClientConfig {
// properties from module 'node-pool'
max?: number;
min?: number;
refreshIdle?: boolean;
idleTimeoutMillis?: number;
reapIntervalMillis?: number;
returnToHead?: boolean;
// properties from module 'node-pool'
max?: number;
min?: number;
refreshIdle?: boolean;
idleTimeoutMillis?: number;
reapIntervalMillis?: number;
returnToHead?: boolean;
}
export interface QueryConfig {
@@ -90,7 +92,7 @@ export declare class Client extends events.EventEmitter {
constructor(connection: string);
constructor(config: ClientConfig);
connect(callback?: (err:Error) => void): void;
connect(callback?: (err:Error) => void): void;
end(): void;
release(): void;
@@ -126,6 +128,6 @@ export declare class Events extends events.EventEmitter {
public on(event: string, listener: Function): this;
}
declare namespace types {
function setTypeParser<T>(typeId: number, parser: (value: string) => T): void;
}
export const types: typeof pgTypes;

View File

@@ -4,19 +4,23 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type value = string | boolean | number;
interface StringifyOptions { strict?: boolean; encode?: boolean; }
/**
* Parse a query string into an object.
* Leading ? or # are ignored, so you can pass location.search or location.hash directly.
* @param str
*/
export declare function parse(str: string): any;
export declare function parse(str: string): { [key: string]: string | string[] };
/**
* Stringify an object into a query string, sorting the keys.
*
* @param obj
*/
export declare function stringify(obj: any, options?: { strict: boolean }): string;
export declare function stringify(obj: { [key: string]: value | value[] }, options?: StringifyOptions): string;
/**
* Extract a query string from a URL that can be passed into .parse().

10
ws/index.d.ts vendored
View File

@@ -99,6 +99,14 @@ declare namespace WebSocket {
rejectUnauthorized?: boolean;
}
export interface IPerMessageDeflateOptions {
serverNoContextTakeover?: boolean;
clientNoContextTakeover?: boolean;
serverMaxWindowBits?: number;
clientMaxWindowBits?: number;
memLevel?: number;
}
export interface IPerMessageDeflateOptions {
serverNoContextTakeover?: boolean;
clientNoContextTakeover?: boolean;
@@ -117,7 +125,7 @@ declare namespace WebSocket {
noServer?: boolean;
disableHixie?: boolean;
clientTracking?: boolean;
perMessageDeflate?: boolean | IPerMessageDeflateOptions;
perMessageDeflate?: boolean | IPerMessageDeflateOptions;
}
export class Server extends events.EventEmitter {

8
yargs/index.d.ts vendored
View File

@@ -18,6 +18,12 @@ declare namespace yargs {
terminalWidth(): number;
terminalWidth(): number;
terminalWidth(): number;
terminalWidth(): number;
alias(shortName: string, longName: string): Argv;
alias(aliases: { [shortName: string]: string }): Argv;
alias(aliases: { [shortName: string]: string[] }): Argv;
@@ -133,7 +139,7 @@ declare namespace yargs {
count(key: string): Argv;
count(keys: string[]): Argv;
fail(func: (msg: string, err?: Error) => any): Argv;
fail(func: (msg: string, err: Error) => any): Argv;
coerce<T, U>(key: string|string[], func: (arg: T) => U): Argv;
coerce<T, U>(opts: { [key: string]: (arg: T) => U; }): Argv;