Convert more packages to types-2.0 style

This commit is contained in:
Andy Hanson
2016-11-04 13:48:19 -07:00
parent c016b5b79f
commit a1fbe3bc3f
37 changed files with 730 additions and 566 deletions
+1
View File
@@ -0,0 +1 @@
$().bootstrapTable({});
@@ -3,7 +3,7 @@
// Definitions by: Talat Baig <https://github.com/talatbaig/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference types="jquery" />
interface JQuery {
bootstrapTable(options?: any): JQuery;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bootstrap-table-tests.ts"
]
}
+1 -5
View File
@@ -1,7 +1,3 @@
/// <reference path="./bwip-js.d.ts" />
/// <reference path="../node/node.d.ts" />
'use strict';
import * as bwipjs from 'bwip-js';
import * as http from 'http';
import * as fs from 'fs';
@@ -13,7 +9,7 @@ bwipjs.loadFont('Inconsolata', 108,
http.createServer(function(req, res) {
// If the url does not begin /?bcid= then 404. Otherwise, we end up
// returning 400 on requests like favicon.ico.
if (req.url.indexOf('/?bcid=') != 0) {
if (req.url!.indexOf('/?bcid=') != 0) {
res.writeHead(404, { 'Content-Type':'text/plain' });
res.end('BWIPJS: Unknown request format.', 'utf8');
} else {
+59 -62
View File
@@ -3,84 +3,81 @@
// Definitions by: TANAKA Koichi <https://github.com/MugeSo/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference types="node" />
declare module 'bwip-js' {
import {IncomingMessage as Request, ServerResponse as Response} from 'http';
import {IncomingMessage as Request, ServerResponse as Response} from 'http';
module BwipJs {
export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void;
export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void;
interface ToBufferOptions {
bcid: string;
text: string;
declare namespace BwipJs {
export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void;
export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void;
interface ToBufferOptions {
bcid: string;
text: string;
parse?: boolean;
parsefunc?: boolean;
parse?: boolean;
parsefunc?: boolean;
height?: number;
width?: number;
height?: number;
width?: number;
scaleX?: number;
scaleY?: number;
scale?: number;
scaleX?: number;
scaleY?: number;
scale?: number;
rotate?: 'N'|'R'|'L'|'I';
rotate?: 'N'|'R'|'L'|'I';
paddingwidth?: number;
paddingheight?: number;
paddingwidth?: number;
paddingheight?: number;
monochrome?: boolean;
alttext?: boolean;
monochrome?: boolean;
alttext?: boolean;
includetext?: boolean;
textfont?: string;
textsize?: number;
textgaps?: number;
includetext?: boolean;
textfont?: string;
textsize?: number;
textgaps?: number;
textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify';
textyalign?:'below'|'center'|'above';
textxoffset?: number;
textyoffset?: number;
textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify';
textyalign?:'below'|'center'|'above';
textxoffset?: number;
textyoffset?: number;
showborder?: boolean;
borderwidth?: number;
borderleft?: number;
borderright?: number;
bordertop?: number;
boraderbottom?: number;
showborder?: boolean;
borderwidth?: number;
borderleft?: number;
borderright?: number;
bordertop?: number;
boraderbottom?: number;
barcolor?: string;
backgroundcolor?: string;
bordercolor?: string;
textcolor?: string;
barcolor?: string;
backgroundcolor?: string;
bordercolor?: string;
textcolor?: string;
addontextxoffset?: number;
addontextyoffset?: number;
addontextfont?: string;
addontextsize?: number;
addontextxoffset?: number;
addontextyoffset?: number;
addontextfont?: string;
addontextsize?: number;
guardwhitespace?: boolean;
guardwidth?: number;
guardheight?: number;
guardleftpos?: number;
guardrightpos?: number;
guardleftypos?: number;
guardrightypos?: number;
guardwhitespace?: boolean;
guardwidth?: number;
guardheight?: number;
guardleftpos?: number;
guardrightpos?: number;
guardleftypos?: number;
guardrightypos?: number;
sizelimit?: number;
sizelimit?: number;
includecheck?: boolean;
includecheckintext?: boolean;
includecheck?: boolean;
includecheckintext?: boolean;
inkspread?: number;
inkspreadh?: number;
inkspreadv?: number;
}
inkspread?: number;
inkspreadh?: number;
inkspreadv?: number;
}
function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void;
export = BwipJs;
}
declare function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void;
export = BwipJs;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bwip-js-tests.ts"
]
}
-1
View File
@@ -1,4 +1,3 @@
/// <reference path="fossil-delta.d.ts" />
import * as fossilDelta from "fossil-delta";
var origin = new Array<number>(1,2,3);
+6 -7
View File
@@ -3,11 +3,10 @@
// Definitions by: Endel Dreyer <https://github.com/endel/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "fossil-delta" {
type ByteArray = Array<number> | Uint8Array | Buffer;
/// <reference types="node" />
export function create(origin: ByteArray, target: ByteArray): Array<number>;
export function apply(origin: ByteArray, delta: Array<number>): Array<number>;
export function outputSize(delta: Array<number>): number;
}
type ByteArray = Array<number> | Uint8Array | Buffer;
export function create(origin: ByteArray, target: ByteArray): Array<number>;
export function apply(origin: ByteArray, delta: Array<number>): Array<number>;
export function outputSize(delta: Array<number>): number;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"fossil-delta-tests.ts"
]
}
+1 -4
View File
@@ -1,6 +1,3 @@
/// <reference path="gulp-cache.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import * as fs from "fs";
import * as gulp from "gulp";
import * as cache from "gulp-cache";
@@ -29,7 +26,7 @@ var jsHintVersion = '2.4.1',
jshintOptions = fs.readFileSync('.jshintrc');
function makeHashKey(file: File) {
return [file.contents.toString('utf8'), jsHintVersion, jshintOptions].join('');
return [(file.contents as Buffer).toString('utf8'), jsHintVersion, jshintOptions].join('');
}
gulp.task('clear', function (done: any) {
+76 -80
View File
@@ -3,92 +3,88 @@
// Definitions by: Arun Aravind <https://github.com/aravindarun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../vinyl/vinyl.d.ts" />
/// <reference path="../gulp-util/gulp-util.d.ts" />
/// <reference types="node" />
declare module "gulp-cache" {
import File = require("vinyl");
import { Transform } from "stream";
import { PluginError } from "gulp-util";
import File = require("vinyl");
import { Transform } from "stream";
import { PluginError } from "gulp-util";
namespace gc {
type Predicate<T> = (arg: T) => boolean;
declare namespace gc {
type Predicate<T> = (arg: T) => boolean;
interface IGulpCacheOptions {
/**
* The cache instance to use for caching.
*/
fileCache?: IGulpCache;
/**
* The name of the bucket which stores the cached objects.
* Default value = 'default'
*/
name?: string,
/**
* The hash generator to use.
*/
key?: (file: File, callback?: (err: any, result: string) => void) => string | Promise<string>;
/**
* Value representing the success of a task.
*/
success?: boolean | Predicate<any>;
/**
* Content that is to be cached.
*/
value?: (result: any) => Object | Promise<Object> | string;
}
interface ICacheOptions {
/**
* Specifies the name of the directory where the cache
* is to be stored.
*/
cacheDirName: string;
}
interface IGulpCacheStatic {
/**
* Caches the result of a task.
* @param task The task whose result is to be cached.
*/
(task: NodeJS.ReadWriteStream): Transform;
/**
* Caches the result of a task.
* @param task Task whose result is to be cached.
* @param options Override values for available settings.
*/
(task: NodeJS.ReadWriteStream, options: IGulpCacheOptions): Transform;
clear(options: IGulpCacheOptions): Transform;
/**
* Represents a cache store.
*/
Cache: IGulpCache;
/**
* Purges the cache.
* @param err PluginError instance in case of a plugin error.
* If callback is not specified an exception of type
* 'PluginError' is thrown.
*/
clearAll(callback?: (err: PluginError) => void): void;
}
interface IGulpCacheOptions {
/**
* The cache instance to use for caching.
*/
fileCache?: IGulpCache;
/**
* Represents a cach store.
* The name of the bucket which stores the cached objects.
* Default value = 'default'
*/
interface IGulpCache {
new (options: ICacheOptions): any;
}
name?: string,
/**
* The hash generator to use.
*/
key?: (file: File, callback?: (err: any, result: string) => void) => string | Promise<string>;
/**
* Value representing the success of a task.
*/
success?: boolean | Predicate<any>;
/**
* Content that is to be cached.
*/
value?: (result: any) => Object | Promise<Object> | string;
}
const _: gc.IGulpCacheStatic;
export = _;
interface ICacheOptions {
/**
* Specifies the name of the directory where the cache
* is to be stored.
*/
cacheDirName: string;
}
interface IGulpCacheStatic {
/**
* Caches the result of a task.
* @param task The task whose result is to be cached.
*/
(task: NodeJS.ReadWriteStream): Transform;
/**
* Caches the result of a task.
* @param task Task whose result is to be cached.
* @param options Override values for available settings.
*/
(task: NodeJS.ReadWriteStream, options: IGulpCacheOptions): Transform;
clear(options: IGulpCacheOptions): Transform;
/**
* Represents a cache store.
*/
Cache: IGulpCache;
/**
* Purges the cache.
* @param err PluginError instance in case of a plugin error.
* If callback is not specified an exception of type
* 'PluginError' is thrown.
*/
clearAll(callback?: (err: PluginError) => void): void;
}
/**
* Represents a cach store.
*/
interface IGulpCache {
new (options: ICacheOptions): any;
}
}
declare const _: gc.IGulpCacheStatic;
export = _;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gulp-cache-tests.ts"
]
}
-3
View File
@@ -1,6 +1,3 @@
/// <reference path="../gulp/gulp.d.ts" />
/// <reference path="gulp-copy.d.ts" />
import * as gulp from "gulp";
import * as gulpCopy from "gulp-copy";
+24 -29
View File
@@ -3,37 +3,32 @@
// Definitions by: Arun Aravind <https://github.com/aravindarun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../through/through.d.ts" />
import through = require("through");
declare module "gulp-copy" {
import through = require("through");
/**
* Copy files to destination and expose those files as source streams for the gulp pipeline.
*
* @param outDirectory The name of the destination directory. If this directory
* does not exist, it will be created atomatically.
*/
declare function gulpCopy(outDirectory: string): through.ThroughStream;
/**
* Copy files to destination and expose those files as source streams for the gulp pipeline.
*
* @param outDirectory The name of the destination directory. If this directory
* does not exist, it will be created atomatically.
*/
function gulpCopy(outDirectory: string): through.ThroughStream;
/**
* Copy files to destination and expose those files as source streams for the gulp pipeline.
*
* @param outDirectory The name of the destination directory. If this directory
* does not exist, it will be created atomatically.
* @param options Override values for available settings.
*/
declare function gulpCopy(outDirectory: string, options: gulpCopy.GulpCopyOptions): through.ThroughStream;
/**
* Copy files to destination and expose those files as source streams for the gulp pipeline.
*
* @param outDirectory The name of the destination directory. If this directory
* does not exist, it will be created atomatically.
* @param options Override values for available settings.
*/
function gulpCopy(outDirectory: string, options: gulpCopy.GulpCopyOptions): through.ThroughStream;
namespace gulpCopy {
export interface GulpCopyOptions {
/**
* Specifies the number of parts of the path to be ignored as path prefixes.
*/
prefix: number;
}
declare namespace gulpCopy {
export interface GulpCopyOptions {
/**
* Specifies the number of parts of the path to be ignored as path prefixes.
*/
prefix: number;
}
export = gulpCopy;
}
export = gulpCopy;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gulp-copy-tests.ts"
]
}
+45 -50
View File
@@ -10,59 +10,54 @@
app.use(passport.session());
=============================================== */
/// <reference path="../koa/koa.d.ts"/>
/// <reference path="../passport/passport.d.ts"/>
declare module "koa-passport" {
import * as Koa from "koa";
declare module "koa" {
interface Request {
authInfo?: any;
user?: any;
import * as Koa from "koa";
module "koa" {
interface Request {
authInfo?: any;
user?: any;
login(user: any): Promise<void>;
login(user: any, options: Object): Promise<void>;
logIn(user: any): Promise<void>;
logIn(user: any, options: Object): Promise<void>;
login(user: any): Promise<void>;
login(user: any, options: Object): Promise<void>;
logIn(user: any): Promise<void>;
logIn(user: any, options: Object): Promise<void>;
logout(): void;
logOut(): void;
logout(): void;
logOut(): void;
isAuthenticated(): boolean;
isUnauthenticated(): boolean;
}
isAuthenticated(): boolean;
isUnauthenticated(): boolean;
}
import * as passport from "passport";
interface Middleware { (ctx: Koa.Context, next: () => Promise<any>): any; }
interface KoaPassport {
use(strategy: passport.Strategy): this;
use(name: string, strategy: passport.Strategy): this;
unuse(name: string): this;
framework(fw: passport.Framework): this;
initialize(options?: { userProperty: string; }): Middleware;
session(options?: { pauseStream: boolean; }): Middleware;
authenticate(strategy: string, callback?: Function): Middleware;
authenticate(strategy: string, options: Object, callback?: Function): Middleware;
authenticate(strategies: string[], callback?: Function): Middleware;
authenticate(strategies: string[], options: Object, callback?: Function): Middleware;
authorize(strategy: string, callback?: Function): Middleware;
authorize(strategy: string, options: Object, callback?: Function): Middleware;
authorize(strategies: string[], callback?: Function): Middleware;
authorize(strategies: string[], options: Object, callback?: Function): Middleware;
serializeUser(fn: (user: any, done: (err: any, id: any) => void) => void): void;
deserializeUser(fn: (id: any, done: (err: any, user: any) => void) => void): void;
transformAuthInfo(fn: (info: any, done: (err: any, info: any) => void) => void): void;
}
const koaPassport: KoaPassport;
namespace KoaPassport {
interface Profile extends passport.Profile { }
interface Framework extends passport.Framework { }
}
export = koaPassport;
}
import * as passport from "passport";
interface Middleware { (ctx: Koa.Context, next: () => Promise<any>): any; }
interface KoaPassport {
use(strategy: passport.Strategy): this;
use(name: string, strategy: passport.Strategy): this;
unuse(name: string): this;
framework(fw: passport.Framework): this;
initialize(options?: { userProperty: string; }): Middleware;
session(options?: { pauseStream: boolean; }): Middleware;
authenticate(strategy: string, callback?: Function): Middleware;
authenticate(strategy: string, options: Object, callback?: Function): Middleware;
authenticate(strategies: string[], callback?: Function): Middleware;
authenticate(strategies: string[], options: Object, callback?: Function): Middleware;
authorize(strategy: string, callback?: Function): Middleware;
authorize(strategy: string, options: Object, callback?: Function): Middleware;
authorize(strategies: string[], callback?: Function): Middleware;
authorize(strategies: string[], options: Object, callback?: Function): Middleware;
serializeUser(fn: (user: any, done: (err: any, id: any) => void) => void): void;
deserializeUser(fn: (id: any, done: (err: any, user: any) => void) => void): void;
transformAuthInfo(fn: (info: any, done: (err: any, info: any) => void) => void): void;
}
declare const koaPassport: KoaPassport;
declare namespace KoaPassport {
interface Profile extends passport.Profile { }
interface Framework extends passport.Framework { }
}
export = koaPassport;
-3
View File
@@ -1,6 +1,3 @@
/// <reference path="../koa/koa.d.ts"/>
/// <reference path="./koa-passport.d.ts"/>
import * as Koa from 'koa';
import * as passport from 'koa-passport';
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"koa-passport-tests.ts"
]
}
+26 -32
View File
@@ -13,38 +13,32 @@
=============================================== */
/// <reference path="../koa/koa.d.ts" />
/// <reference path="../cookies/cookies.d.ts"/>
import * as Koa from "koa";
import * as cookies from "cookies";
declare module "koa-session-minimal" {
import * as Koa from "koa";
import * as cookies from "cookies";
module "koa" {
interface Request {
session: any;
sessionHandler: { regenerateId: () => void };
}
declare module "koa" {
interface Request {
session: any;
sessionHandler: { regenerateId: () => void };
}
function session(opts?: {
/**
* session cookie name and store key prefix. Default is 'koa:sess'
*/
key?: string;
/**
* cookie options
*/
cookie?: cookies.IOptions | { (ctx?: Koa.Context): cookies.IOptions };
/**
* session store
*/
store?: any;
}): { (ctx: Koa.Context, next?: () => any): any };
namespace session {}
export = session;
}
declare function session(opts?: {
/**
* session cookie name and store key prefix. Default is 'koa:sess'
*/
key?: string;
/**
* cookie options
*/
cookie?: cookies.IOptions | { (ctx?: Koa.Context): cookies.IOptions };
/**
* session store
*/
store?: any;
}): { (ctx: Koa.Context, next?: () => any): any };
declare namespace session {}
export = session;
@@ -1,6 +1,3 @@
/// <reference path="../koa/koa.d.ts" />
/// <reference path="koa-session-minimal.d.ts" />
import * as Koa from "koa";
import * as session from "koa-session-minimal";
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"koa-session-minimal-tests.ts"
]
}
+25 -29
View File
@@ -3,36 +3,32 @@
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../nodemailer/nodemailer.d.ts"/>
declare module "nodemailer-stub-transport" {
import * as nodemailer from "nodemailer";
namespace StubTransportStatic {
/**
* Options.
* @interface
*/
export interface Options {
/**
* Specifies a custom error.
* @type {any}
*/
error?: any;
/**
* Value that indicates if the BCC addresses must be included in generated message.
* @type {boolean}
*/
keepBcc?: boolean;
}
}
import * as nodemailer from "nodemailer";
declare namespace StubTransportStatic {
/**
* Creates a stub transport.
* @param {Options} [options] Options.
* @return {Transport} The stub transport.
* Options.
* @interface
*/
function stubTransport(options?: StubTransportStatic.Options): nodemailer.Transport;
export = stubTransport;
export interface Options {
/**
* Specifies a custom error.
* @type {any}
*/
error?: any;
/**
* Value that indicates if the BCC addresses must be included in generated message.
* @type {boolean}
*/
keepBcc?: boolean;
}
}
/**
* Creates a stub transport.
* @param {Options} [options] Options.
* @return {Transport} The stub transport.
*/
declare function stubTransport(options?: StubTransportStatic.Options): nodemailer.Transport;
export = stubTransport;
@@ -1,5 +1,3 @@
/// <reference path="nodemailer-stub-transport.d.ts"/>
import nodemailer = require("nodemailer");
import stubTransport = require("nodemailer-stub-transport");
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"nodemailer-stub-transport-tests.ts"
]
}
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: rhysd <https://rhysd.github.io>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference types="node" />
declare namespace PageIcon {
interface Icon {
-2
View File
@@ -1,5 +1,3 @@
/// <reference path="./page-icon.d.ts" />
import * as pageIcon from "page-icon";
const siteUrl = "https://www.facebook.com/";
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"page-icon-tests.ts"
]
}
-3
View File
@@ -3,9 +3,6 @@
// Definitions by: Christophe Vidal <https://github.com/krizalys>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../passport/index.d.ts"/>
/// <reference path="../express/index.d.ts"/>
import passport = require("passport");
import express = require("express");
+13 -18
View File
@@ -3,25 +3,20 @@
// Definitions by: Remo H. Jansen <https://github.com/remojansen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../react/react.d.ts"/>
import React = require("react");
declare module "react-side-effect" {
declare function withSideEffect(
reducePropsToState: (propsList: any[]) => any,
handleStateChangeOnClient: (state: any) => any,
mapStateOnServer?: (state: any) => any
): ClassDecorator;
import React = __React;
declare class ElementClass extends React.Component<any, any> {}
function withSideEffect(
reducePropsToState: (propsList: any[]) => any,
handleStateChangeOnClient: (state: any) => any,
mapStateOnServer?: (state: any) => any
): ClassDecorator;
class ElementClass extends React.Component<any, any> {}
interface ClassDecorator {
<T extends (typeof ElementClass)>(component:T): T;
}
namespace withSideEffect {} // https://github.com/Microsoft/TypeScript/issues/5073
export = withSideEffect;
interface ClassDecorator {
<T extends (typeof ElementClass)>(component:T): T;
}
declare namespace withSideEffect {} // https://github.com/Microsoft/TypeScript/issues/5073
export = withSideEffect;
@@ -1,5 +1,3 @@
/// <reference path="react-side-effect.d.ts" />
import * as React from "react";
import * as withSideEffect from "react-side-effect";
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-side-effect-tests.ts"
]
}
+218 -221
View File
@@ -3,240 +3,237 @@
// Definitions by: Mike Jerred <https://github.com/MikeJerred>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../mime/mime.d.ts" />
/// <reference types="node" />
declare module "send" {
import * as stream from "stream";
import * as fs from "fs";
import * as stream from "stream";
import * as fs from "fs";
/**
* Create a new SendStream for the given path to send to a res.
* The req is the Node.js HTTP request and the path is a urlencoded path to send (urlencoded, not the actual file-system path).
*/
function send(req: stream.Readable, path: string, options?: send.SendOptions): send.SendStream;
/**
* Create a new SendStream for the given path to send to a res.
* The req is the Node.js HTTP request and the path is a urlencoded path to send (urlencoded, not the actual file-system path).
*/
declare function send(req: stream.Readable, path: string, options?: send.SendOptions): send.SendStream;
import * as m from "mime";
import * as m from "mime";
namespace send {
var mime: typeof m;
interface SendOptions {
/**
* Enable or disable accepting ranged requests, defaults to true.
* Disabling this will not send Accept-Ranges and ignore the contents of the Range request header.
*/
acceptRanges?: boolean;
declare namespace send {
var mime: typeof m;
interface SendOptions {
/**
* Enable or disable accepting ranged requests, defaults to true.
* Disabling this will not send Accept-Ranges and ignore the contents of the Range request header.
*/
acceptRanges?: boolean;
/**
* Enable or disable setting Cache-Control response header, defaults to true.
* Disabling this will ignore the maxAge option.
*/
cacheControl?: boolean;
/**
* Enable or disable setting Cache-Control response header, defaults to true.
* Disabling this will ignore the maxAge option.
*/
cacheControl?: boolean;
/**
* Set how "dotfiles" are treated when encountered.
* A dotfile is a file or directory that begins with a dot (".").
* Note this check is done on the path itself without checking if the path actually exists on the disk.
* If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
* 'allow' No special treatment for dotfiles.
* 'deny' Send a 403 for any request for a dotfile.
* 'ignore' Pretend like the dotfile does not exist and 404.
* The default value is similar to 'ignore', with the exception that this default will not ignore the files within a directory that begins with a dot, for backward-compatibility.
*/
dotfiles?: "allow" | "deny" | "ignore";
/**
* Set how "dotfiles" are treated when encountered.
* A dotfile is a file or directory that begins with a dot (".").
* Note this check is done on the path itself without checking if the path actually exists on the disk.
* If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
* 'allow' No special treatment for dotfiles.
* 'deny' Send a 403 for any request for a dotfile.
* 'ignore' Pretend like the dotfile does not exist and 404.
* The default value is similar to 'ignore', with the exception that this default will not ignore the files within a directory that begins with a dot, for backward-compatibility.
*/
dotfiles?: "allow" | "deny" | "ignore";
/**
* Byte offset at which the stream ends, defaults to the length of the file minus 1.
* The end is inclusive in the stream, meaning end: 3 will include the 4th byte in the stream.
*/
end?: number;
/**
* Byte offset at which the stream ends, defaults to the length of the file minus 1.
* The end is inclusive in the stream, meaning end: 3 will include the 4th byte in the stream.
*/
end?: number;
/**
* Enable or disable etag generation, defaults to true.
*/
etag?: boolean;
/**
* Enable or disable etag generation, defaults to true.
*/
etag?: boolean;
/**
* If a given file doesn't exist, try appending one of the given extensions, in the given order.
* By default, this is disabled (set to false).
* An example value that will serve extension-less HTML files: ['html', 'htm'].
* This is skipped if the requested file already has an extension.
*/
extensions?: string[] | string | boolean;
/**
* If a given file doesn't exist, try appending one of the given extensions, in the given order.
* By default, this is disabled (set to false).
* An example value that will serve extension-less HTML files: ['html', 'htm'].
* This is skipped if the requested file already has an extension.
*/
extensions?: string[] | string | boolean;
/**
* By default send supports "index.html" files, to disable this set false or to supply a new index pass a string or an array in preferred order.
*/
index?: string[] | string | boolean;
/**
* By default send supports "index.html" files, to disable this set false or to supply a new index pass a string or an array in preferred order.
*/
index?: string[] | string | boolean;
/**
* Enable or disable Last-Modified header, defaults to true.
* Uses the file system's last modified value.
*/
lastModified?: boolean;
/**
* Enable or disable Last-Modified header, defaults to true.
* Uses the file system's last modified value.
*/
lastModified?: boolean;
/**
* Provide a max-age in milliseconds for http caching, defaults to 0.
* This can also be a string accepted by the ms module.
*/
maxAge?: string | number;
/**
* Provide a max-age in milliseconds for http caching, defaults to 0.
* This can also be a string accepted by the ms module.
*/
maxAge?: string | number;
/**
* Serve files relative to path.
*/
root?: string;
/**
* Serve files relative to path.
*/
root?: string;
/**
* Byte offset at which the stream starts, defaults to 0.
* The start is inclusive, meaning start: 2 will include the 3rd byte in the stream.
*/
start?: number;
}
interface SendStream extends stream.Stream {
/**
* @deprecated pass etag as option
* Enable or disable etag generation.
*/
etag(val: boolean): SendStream;
/**
* @deprecated use dotfiles option
* Enable or disable "hidden" (dot) files.
*/
hidden(val: boolean): SendStream;
/**
* @deprecated pass index as option
* Set index `paths`, set to a falsy value to disable index support.
*/
index(paths: string[] | string): SendStream;
/**
* @deprecated pass root as option
* Set root `path`.
*/
root(paths: string): SendStream;
/**
* @deprecated pass root as option
* Set root `path`.
*/
from(paths: string): SendStream;
/**
* @deprecated pass maxAge as option
* Set max-age to `maxAge`.
*/
maxage(maxAge: string | number): SendStream;
/**
* Emit error with `status`.
* @private
*/
error(status: number, error?: Error): void;
/**
* Check if the pathname ends with "/".
* @private
*/
hasTrailingSlash(): boolean;
/**
* Check if this is a conditional GET request.
* @private
*/
isConditionalGET(): boolean;
/**
* Strip content-* header fields.
* @private
*/
removeContentHeaderFields(): void;
/**
* Respond with 304 not modified.
* @private
*/
notModified(): void;
/**
* Raise error that headers already sent.
* @private
*/
headersAlreadySent(): void;
/**
* Check if the request is cacheable, aka responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
* @private
*/
isCachable(): boolean;
/**
* Handle stat() error.
* @private
*/
onStatError(error: Error): void;
/**
* Check if the cache is fresh.
* @private
*/
isFresh(): boolean;
/**
* Check if the range is fresh.
* @private
*/
isRangeFresh(): boolean;
/**
* Redirect to path.
* @private
*/
redirect(path: string): void;
/**
* Pipe to `res`.
*/
pipe(res: stream.Writable): stream.Writable;
/**
* Transfer `path`.
*/
send(path: string, stat?: fs.Stats): void;
/**
* Transfer file for `path`.
* @private
*/
sendFile(path: string): void;
/**
* Transfer index for `path`.
* @private
*/
sendIndex(path: string): void;
/**
* Transfer index for `path`.
* @private
*/
stream(path: string, options?: {}): void;
/**
* Set content-type based on `path` if it hasn't been explicitly set.
* @private
*/
type(path: string): void;
/**
* Set response header fields, most fields may be pre-defined.
* @private
*/
setHeader(path: string, stat: fs.Stats): void;
}
/**
* Byte offset at which the stream starts, defaults to 0.
* The start is inclusive, meaning start: 2 will include the 3rd byte in the stream.
*/
start?: number;
}
export = send;
}
interface SendStream extends stream.Stream {
/**
* @deprecated pass etag as option
* Enable or disable etag generation.
*/
etag(val: boolean): SendStream;
/**
* @deprecated use dotfiles option
* Enable or disable "hidden" (dot) files.
*/
hidden(val: boolean): SendStream;
/**
* @deprecated pass index as option
* Set index `paths`, set to a falsy value to disable index support.
*/
index(paths: string[] | string): SendStream;
/**
* @deprecated pass root as option
* Set root `path`.
*/
root(paths: string): SendStream;
/**
* @deprecated pass root as option
* Set root `path`.
*/
from(paths: string): SendStream;
/**
* @deprecated pass maxAge as option
* Set max-age to `maxAge`.
*/
maxage(maxAge: string | number): SendStream;
/**
* Emit error with `status`.
* @private
*/
error(status: number, error?: Error): void;
/**
* Check if the pathname ends with "/".
* @private
*/
hasTrailingSlash(): boolean;
/**
* Check if this is a conditional GET request.
* @private
*/
isConditionalGET(): boolean;
/**
* Strip content-* header fields.
* @private
*/
removeContentHeaderFields(): void;
/**
* Respond with 304 not modified.
* @private
*/
notModified(): void;
/**
* Raise error that headers already sent.
* @private
*/
headersAlreadySent(): void;
/**
* Check if the request is cacheable, aka responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}).
* @private
*/
isCachable(): boolean;
/**
* Handle stat() error.
* @private
*/
onStatError(error: Error): void;
/**
* Check if the cache is fresh.
* @private
*/
isFresh(): boolean;
/**
* Check if the range is fresh.
* @private
*/
isRangeFresh(): boolean;
/**
* Redirect to path.
* @private
*/
redirect(path: string): void;
/**
* Pipe to `res`.
*/
pipe(res: stream.Writable): stream.Writable;
/**
* Transfer `path`.
*/
send(path: string, stat?: fs.Stats): void;
/**
* Transfer file for `path`.
* @private
*/
sendFile(path: string): void;
/**
* Transfer index for `path`.
* @private
*/
sendIndex(path: string): void;
/**
* Transfer index for `path`.
* @private
*/
stream(path: string, options?: {}): void;
/**
* Set content-type based on `path` if it hasn't been explicitly set.
* @private
*/
type(path: string): void;
/**
* Set response header fields, most fields may be pre-defined.
* @private
*/
setHeader(path: string, stat: fs.Stats): void;
}
}
export = send;
+1 -2
View File
@@ -1,5 +1,4 @@
/// <reference path="send.d.ts" />
/// <reference path="../express/express.d.ts" />
/// <reference types="express" />
import * as express from 'express';
import * as send from 'send';
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"send-tests.ts"
]
}
+2 -5
View File
@@ -3,16 +3,13 @@
// Definitions by: stevehipwell <https://github.com/stevehipwell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../sinon/sinon.d.ts"/>
declare namespace Sinon {
import * as s from "sinon";
declare module "sinon" {
export interface SinonStub {
/**
* When called, the stub will create a new stub to represent a mongoose chained function.
*/
chain(name: string): SinonStub
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
/// <reference path="sinon-mongoose.d.ts"/>
import * as sinon from "sinon";
function testChain() {
sinon.stub().chain('exec');
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"sinon-mongoose-tests.ts"
]
}