Merge branch 'master' into fix/sequelize-addIndex-typings

This commit is contained in:
BRAMILLE Sébastien
2017-08-22 22:48:47 +01:00
committed by GitHub
363 changed files with 6676 additions and 3400 deletions

2405
.github/CODEOWNERS vendored

File diff suppressed because it is too large Load Diff

View File

@@ -277,6 +277,17 @@ Also, `/// <reference types=".." />` will not work with path mapping, so depende
Types for a scoped package `@foo/bar` should go in `types/foo__bar`. Note the double underscore.
When `dts-gen` is used to scaffold a scoped package, the `paths` property has to be manually adapted in the generated
`tsconfig.json` to correctly reference the scoped package:
```json
{
"paths":{
"@foo/bar": ["foo__bar"]
}
}
```
#### The file history in GitHub looks incomplete.

View File

@@ -0,0 +1,13 @@
import abbrev = require('abbrev');
let abbrs: { [abbreviation: string]: string; };
abbrs = abbrev();
abbrs = abbrev('foo', 'fool', 'folding', 'flop');
abbrs = abbrev(['foo', 'fool', 'folding', 'flop']);
abbrev.monkeyPatch();
abbrs = [].abbrev();
const roArr: ReadonlyArray<string> = [];
abbrs = roArr.abbrev();
abbrs = ({}).abbrev();

27
types/abbrev/index.d.ts vendored Normal file
View File

@@ -0,0 +1,27 @@
// Type definitions for abbrev 1.1
// Project: https://github.com/isaacs/abbrev-js#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = abbrev;
declare function abbrev(words: string[]): {[abbreviation: string]: string};
declare function abbrev(...words: string[]): {[abbreviation: string]: string};
declare namespace abbrev {
function monkeyPatch(): void;
}
declare global {
interface Array<T> {
abbrev(): {[abbreviation: string]: string};
}
interface ReadonlyArray<T> {
abbrev(): {[abbreviation: string]: string};
}
interface Object {
abbrev(): {[abbreviation: string]: string};
}
}

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"abbrev-tests.ts"
]
}

1
types/abbrev/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -14,9 +14,7 @@ let obj5 = new ActiveXObject('ADODB.Stream');
let pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx';
let conn = new ActiveXObject('ADODB.Connection');
conn.Provider = 'Microsoft.ACE.OLEDB.12.0';
conn.ConnectionString =
'Data Source="' + pathToExcelFile + '";' +
'Extended Properties="Excel 12.0;HDR=Yes"';
conn.ConnectionString = `Data Source="${pathToExcelFile}";Extended Properties="Excel 12.0;HDR=Yes"`;
conn.Open();
// create a Command to access the data

View File

@@ -40,9 +40,9 @@ function showFileAttributes(file: Scripting.File) {
function showFreeSpace(drvPath: string) {
const fso = new ActiveXObject('Scripting.FileSystemObject');
const d = fso.GetDrive(fso.GetDriveName(drvPath));
let s = 'Drive ' + drvPath + ' - ';
let s = `Drive ${drvPath} - `;
s += d.VolumeName + '<br>';
s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes';
s += `Free Space: ${d.FreeSpace / 1024} Kbytes`;
return (s);
}

View File

@@ -37,14 +37,14 @@ let e = new Enumerator<WIA.Property>(dev.Properties); // no foreach over Active
e.moveFirst();
while (!e.atEnd()) {
const p = e.item();
let s = p.Name + ' (' + p.PropertyID + ') = ';
let s = `${p.Name} (${p.PropertyID}) = `;
if (p.IsVector) {
s += '[vector of data]';
} else {
s += p.Value;
if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType) {
if (p.Value !== p.SubTypeDefault) {
s += ' (Default = ' + p.SubTypeDefault + ')';
s += ` (Default = ${p.SubTypeDefault})`;
}
}
}
@@ -70,7 +70,7 @@ while (!e.atEnd()) {
s += ']';
break;
case WIA.WiaSubType.RangeSubType:
s += ' [valid values in the range from ' + p.SubTypeMin + ' to ' + p.SubTypeMax + ' in increments of ' + p.SubTypeStep + ']';
s += ` [valid values in the range from ${p.SubTypeMin} to ${p.SubTypeMax} in increments of ${p.SubTypeStep}]`;
break;
}
}

View File

@@ -36,7 +36,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
let expr1 = new Expression("a").add("b").add("c");
let expr2 = new Expression("c").subtract("b");
let expr3 = expr1.subtract(expr2);
expr1.toString() + " - (" + expr2.toString() + ") = " + expr3.toString();
`${expr1.toString()} - (${expr2.toString()}) = ${expr3.toString()}`;
expr1 = new Expression("x");
expr1 = expr1.add(2);
@@ -46,7 +46,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
expr2 = expr2.multiply(new Fraction(1, 3));
expr2 = expr2.add(4);
expr3 = expr1.multiply(expr2);
"(" + expr1.toString() + ")(" + expr2.toString() + ") = " + expr3.toString();
`(${expr1.toString()})(${expr2.toString()}) = ${expr3.toString()}`;
x = new Expression("x").divide(2).divide(new Fraction(1, 5));
x.toString();
@@ -58,7 +58,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
sum.toString();
exp = new Expression("x").add(2);
const exp3 = exp.pow(3);
"(" + exp.toString() + ")^3 = " + exp3.toString();
`(${exp.toString()})^3 = ${exp3.toString()}`;
let expr = new Expression("x");
expr = expr.multiply(2);

View File

@@ -49,6 +49,7 @@ export interface AMQPQueue extends events.EventEmitter {
export interface AMQPExchange extends events.EventEmitter {
on(event: 'open' | 'ack' | 'error' | 'exchangeBindOk' | 'exchangeUnbindOk', callback: Callback<void>): this;
publish(routingKey: string, message: Buffer | {}, callback: (err?: boolean, msg?: string) => void): void;
publish(routingKey: string, message: Buffer | {}, options: ExchangePublishOptions, callback?: (err?: boolean, msg?: string) => void): void;
/**

View File

@@ -1,8 +1,8 @@
import * as angular from "angular";
import * as ng from 'angular';
let myApp = angular.module('myApp', ['feature-flags']);
const myApp = ng.module('myApp', ['feature-flags']);
const flagsData: Array<angular.featureflags.FlagData> = [
const flagsData: Array<ng.featureflags.FlagData> = [
{
key: '1',
active: true,
@@ -17,15 +17,16 @@ const flagsData: Array<angular.featureflags.FlagData> = [
}
];
myApp.config(function (featureFlagsProvider: angular.featureflags.FeatureFlagsProvider) {
myApp.config(function(featureFlagsProvider: ng.featureflags.FeatureFlagsProvider) {
featureFlagsProvider.setInitialFlags(flagsData);
});
myApp.run(function ($q: angular.IQService, $http: angular.IHttpService, featureFlags: angular.featureflags.FeatureFlagsService) {
let deferred = $q.defer();
deferred.resolve(flagsData);
featureFlags.set(deferred.promise);
myApp.run(function(
$q: ng.IQService,
$http: ng.IHttpService,
featureFlags: ng.featureflags.FeatureFlagsService
) {
featureFlags.set($q.resolve(flagsData));
featureFlags.set($http.get('/data/flags.json'));
});
featureFlags.set($http.get<Array<ng.featureflags.FlagData>>('/data/flags.json'));
});

View File

@@ -6,9 +6,9 @@
/// <reference types="angular" />
import * as angular from "angular";
import * as ng from 'angular';
declare module "angular" {
declare module 'angular' {
namespace featureflags {
export interface FlagData {
/**
@@ -27,17 +27,22 @@ declare module "angular" {
name: string;
/**
* A long description of the flag to further explain the feature being toggled (only visible in the list of flags)
* A long description of the flag to further explain the feature being toggled
* (only visible in the list of flags)
*/
description: string;
}
export interface FeatureFlagsProvider {
setInitialFlags(flags: Array<FlagData>): void;
setInitialFlags(flags: ReadonlyArray<FlagData>): void;
}
export interface FeatureFlagsService {
set(flagsPromise: angular.IPromise<FlagData> | angular.IHttpPromise<FlagData>): void;
set(
flagsPromise:
| ng.IPromise<ReadonlyArray<FlagData>>
| ng.IHttpPromise<ReadonlyArray<FlagData>>
): void;
}
}
}

View File

@@ -59,10 +59,9 @@ function MainController($resource: ng.resource.IResourceService): void {
});
}
import IHttpPromiseCallbackArg = angular.IHttpPromiseCallbackArg;
import IHttpResponse = angular.IHttpResponse;
interface IMyData {}
interface IMyHttpPromiseCallbackArg extends IHttpPromiseCallbackArg<IMyData> {}
interface IMyResource extends angular.resource.IResource<IMyResource> {}
interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource> {}
@@ -87,7 +86,7 @@ angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactorySe
actionDescriptor.withCredentials = true;
actionDescriptor.responseType = 'response type';
actionDescriptor.interceptor = {
response() { return {} as IMyHttpPromiseCallbackArg; },
response() { return {} as IHttpResponse<IMyData>; },
responseError() {}
};
actionDescriptor.cancellable = true;

View File

@@ -210,7 +210,7 @@ declare module 'angular' {
declare global {
interface Array<T> {
/** The promise of the original server interaction that created this collection. */
$promise: IPromise<T[]>;
$promise: angular.IPromise<T[]>;
$resolved: boolean;
}
}

View File

@@ -157,7 +157,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
// Note that we do not concern ourselves with what to do if this request fails,
// because if it fails, the web page will be redirected away to the login screen.
this.$http({ url: "/api/me", method: "GET" }).then((response: ng.IHttpPromiseCallbackArg<any>) => {
this.$http({ url: "/api/me", method: "GET" }).then((response: ng.IHttpResponse<any>) => {
this.currentUser = response.data;
// sync the ui-state with the location in the browser, which effectively

View File

@@ -61,31 +61,38 @@ angular.module('http-auth-interceptor', [])
* $http interceptor.
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.config(['$httpProvider', 'authServiceProvider', ($httpProvider: ng.IHttpProvider, authServiceProvider: any) => {
$httpProvider.defaults.headers.common = {Authorization: 'Bearer token'};
$httpProvider.defaults.headers.get['Authorization'] = 'Bearer token';
$httpProvider.defaults.headers.post['Authorization'] = (config: ng.IRequestConfig) => 'Bearer token';
.config([
'$httpProvider', 'authServiceProvider',
($httpProvider: ng.IHttpProvider, authServiceProvider: AuthService) => {
$httpProvider.defaults.headers.common = { Authorization: 'Bearer token' };
$httpProvider.defaults.headers.get.Authorization = 'Bearer token';
$httpProvider.defaults.headers.post['Authorization'] = (config: ng.IRequestConfig) =>
'Bearer token';
const interceptor = ['$rootScope', '$q', ($rootScope: ng.IScope, $q: ng.IQService) => {
function success(response: ng.IHttpPromiseCallbackArg<any>) {
return response;
}
function error(response: ng.IHttpPromiseCallbackArg<any>) {
if (response.status === 401) {
const deferred = $q.defer<void>();
authServiceProvider.pushToBuffer(response.config, deferred);
$rootScope.$broadcast('event:auth-loginRequired');
return deferred.promise;
const interceptor = [
'$rootScope', '$q',
($rootScope: ng.IScope, $q: ng.IQService) => {
return {
request(config: ng.IRequestConfig) {
if (!config.params) config.params = {};
config.params.rnd = Math.random();
return config;
},
responseError(rejection: any) {
if (rejection.status === 401) {
const deferred = $q.defer<ng.IHttpResponse<any>>();
authServiceProvider.pushToBuffer(rejection.config, deferred);
$rootScope.$broadcast('event:auth-loginRequired');
return deferred.promise;
}
return $q.reject(rejection);
}
};
}
// otherwise
return $q.reject(response);
}
return (promise: ng.IHttpPromise<any>) => promise.then(success, error);
}];
$httpProvider.interceptors.push(interceptor);
}]);
];
$httpProvider.interceptors.push(interceptor);
}
]);
namespace HttpAndRegularPromiseTests {
interface Person {
@@ -105,7 +112,7 @@ namespace HttpAndRegularPromiseTests {
function someController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
.then((response: ng.IHttpResponse<ExpectedResponse>) => {
// typing lost, so something like
// const i: number = response.data
// would type check
@@ -113,7 +120,7 @@ namespace HttpAndRegularPromiseTests {
});
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
.then((response: ng.IHttpResponse<ExpectedResponse>) => {
// typing lost, so something like
// const i: number = response.data
// would NOT type check
@@ -426,7 +433,7 @@ httpFoo.then((x) => {
x.toFixed();
});
httpFoo.then((response: ng.IHttpPromiseCallbackArg<any>) => {
httpFoo.then((response: ng.IHttpResponse<any>) => {
const h = response.headers('test');
h.charAt(0);
const hs = response.headers();
@@ -565,7 +572,7 @@ namespace TestPromise {
(reason) => anyOf3(reject, tresult, tresultPromise)
));
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult>>(promise.then((result) => tresultHttpPromise));
assertPromiseType<ng.IHttpResponse<TResult>>(promise.then((result) => tresultHttpPromise));
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
assertPromiseType<TResult | angular.IPromise<TResult> | angular.IPromise<never> | TOther | angular.IPromise<TOther>>(promise.then(
@@ -580,8 +587,8 @@ namespace TestPromise {
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother, (any) => any));
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise));
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise, (any) => any));
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise));
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any));
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise));
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any));
assertPromiseType<TOther>(promise.then((result) => tother));
assertPromiseType<TOther>(promise.then((result) => tother, (any) => any));
@@ -589,9 +596,9 @@ namespace TestPromise {
assertPromiseType<TOther>(promise.then((result) => totherPromise));
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any));
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any, (any) => any));
assertPromiseType<ng.IHttpPromiseCallbackArg<TOther>>(promise.then((result) => totherHttpPromise));
assertPromiseType<ng.IHttpPromiseCallbackArg<TOther>>(promise.then((result) => totherHttpPromise, (any) => any));
assertPromiseType<ng.IHttpPromiseCallbackArg<TOther>>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any));
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise));
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any));
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any));
assertPromiseType<boolean>(promise.then((result) => tresult, (any) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
@@ -602,10 +609,10 @@ namespace TestPromise {
assertPromiseType<TResult | angular.IPromise<never>>(promise.catch((err) => anyOf2(tresult, reject)));
assertPromiseType<TResult>(promise.catch((err) => anyOf3(tresult, tresultPromise, reject)));
assertPromiseType<TResult>(promise.catch((err) => tresultPromise));
assertPromiseType<TResult | ng.IHttpPromiseCallbackArg<TResult>>(promise.catch((err) => tresultHttpPromise));
assertPromiseType<TResult | ng.IHttpResponse<TResult>>(promise.catch((err) => tresultHttpPromise));
assertPromiseType<TResult | TOther>(promise.catch((err) => tother));
assertPromiseType<TResult | TOther>(promise.catch((err) => totherPromise));
assertPromiseType<TResult | ng.IHttpPromiseCallbackArg<TOther>>(promise.catch((err) => totherHttpPromise));
assertPromiseType<TResult | ng.IHttpResponse<TOther>>(promise.catch((err) => totherHttpPromise));
assertPromiseType<boolean>(promise.catch((err) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
@@ -620,7 +627,7 @@ function test_angular_forEach() {
const log: string[] = [];
angular.forEach(values, (value, key, obj) => {
obj[key] = value;
this.push(key + ': ' + value);
this.push(`${key}: ${value}`);
}, log);
// expect(log).toEqual(['name: misko', 'gender: male']);
}

View File

@@ -9,6 +9,9 @@
/// <reference path="jqlite.d.ts" />
// NOTE: @types/angular technically doesn't require TypeScript 2.3, only TypeScript 2.1.
// It has a TypeScript 2.3 header so that merging tests with @types/jquery v3 will work.
declare var angular: angular.IAngularStatic;
// Support for painless dependency injection
@@ -1520,23 +1523,27 @@ declare namespace angular {
(data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void;
}
interface IHttpPromiseCallbackArg<T> {
data?: T;
status?: number;
headers?: IHttpHeadersGetter;
config?: IRequestConfig;
statusText?: string;
interface IHttpResponse<T> {
data: T;
status: number;
headers: IHttpHeadersGetter;
config: IRequestConfig;
statusText: string;
/** Added in AngularJS 1.6.6 */
xhrStatus: 'complete' | 'error' | 'timeout' | 'abort';
}
interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
}
/** @deprecated The old name of IHttpResponse. Kept for compatibility. */
type IHttpPromiseCallbackArg<T> = IHttpResponse<T>;
type IHttpPromise<T> = IPromise<IHttpResponse<T>>;
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
interface IHttpRequestTransformer {
(data: any, headersGetter: IHttpHeadersGetter): any;
}
// The definition of fields are the same as IHttpPromiseCallbackArg
// The definition of fields are the same as IHttpResponse
interface IHttpResponseTransformer {
(data: any, headersGetter: IHttpHeadersGetter, status: number): any;
}
@@ -1609,10 +1616,10 @@ declare namespace angular {
}
interface IHttpInterceptor {
request?(config: IRequestConfig): IRequestConfig|IPromise<IRequestConfig>;
requestError?(rejection: any): any;
response?<T>(response: IHttpPromiseCallbackArg<T>): IPromise<IHttpPromiseCallbackArg<T>>|IHttpPromiseCallbackArg<T>;
responseError?(rejection: any): any;
request?(config: IRequestConfig): IRequestConfig | IPromise<IRequestConfig>;
requestError?(rejection: any): IRequestConfig | IPromise<IRequestConfig>;
response?<T>(response: IHttpResponse<T>): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
responseError?<T>(rejection: any): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
}
interface IHttpInterceptorFactory {

View File

@@ -0,0 +1,71 @@
import * as anime from 'animejs';
const test1 = anime({
targets: 'div',
duration: 40,
color: "#FFFFFF"
});
const callback = (anim: any) => {
console.log(anim.completed);
};
const test2 = anime({
targets: 'div',
translateX: (el: HTMLElement, i: number, index: number) => {
return 0;
},
translateY: '40px',
color: [
{value: '#FF0000', duration: 2000},
{value: '#00FF00', duration: 2000},
{value: '#0000FF', duration: 2000},
],
duration: () => {
return 1000000000000;
},
update: callback,
complete: callback
});
const someNodes = document.querySelector('button');
const test3 = anime({
targets: someNodes,
top: "-5000000em"
});
const tl = anime.timeline({
loop: false,
direction: 'normal'
});
tl.add({
targets: ".tiny-divvy-div",
scale: 10000000
});
const path = anime.path('#motionPath path');
test1.play();
test2.reverse();
test3.pause();
tl.seek(4000);
tl.finished.then(() => {
console.log("I wonder if anyone will ever actually read this.");
});
const usesEnums = anime({
targets: ".usingEnumsIsAReallyHandyThing",
direction: "reverse",
easing: "inoutexpo",
someProperty: "+=4000"
});
const bezier = anime.bezier(0, 0, 100, 100);
// anime.speed = 100000000;
(anime as any).speed = 4000;
anime.easings['hello'] = anime.bezier(0, 0, 1900, 3020);
const runningAnims = anime.running;
anime.remove(".tiny-divvy-div");

137
types/animejs/index.d.ts vendored Normal file
View File

@@ -0,0 +1,137 @@
// Type definitions for animejs 2.0
// Project: http://animejs.com
// Definitions by: Andrew Babin <https://github.com/A-Babin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
type FunctionBasedParamter = (element: HTMLElement, index: number, length: number) => number;
type AnimeCallbackFunction = (anim: anime.AnimeInstance) => void;
// Allowing null is necessary because DOM queries may not return anything.
type AnimeTarget = string | object | HTMLElement | SVGElement | NodeList | null;
declare namespace anime {
type EasingOptions =
| "linear"
| "easeInQuad"
| "easeInCubic"
| "easeInQuart"
| "easeInQuint"
| "easeInSine"
| "easeInExpo"
| "easeInCirc"
| "easeInBack"
| "easeInElastic"
| "easeOutQuad"
| "easeOutCubic"
| "easeOutQuart"
| "easeOutQuint"
| "easeOutSine"
| "easeOutExpo"
| "easeOutCirc"
| "easeOutBack"
| "easeOutElastic"
| "easeInOutQuad"
| "easeInOutCubic"
| "easeInOutQuart"
| "easeInOutQuint"
| "easeInOutSine"
| "easeInOutExpo"
| "easeInOutCirc"
| "easeInOutBack"
| "easeInOutElastic";
type DirectionOptions = "reverse" | "alternate" | "normal";
interface AnimeInstanceParams {
loop?: number | boolean;
autoplay?: boolean;
direction?: DirectionOptions | string;
begin?: AnimeCallbackFunction;
run?: AnimeCallbackFunction;
update?: AnimeCallbackFunction;
complete?: AnimeCallbackFunction;
}
interface AnimeAnimParams {
targets: AnimeTarget | ReadonlyArray<AnimeTarget>;
duration?: number | FunctionBasedParamter;
delay?: number | FunctionBasedParamter;
elasticity?: number | FunctionBasedParamter;
round?: number | boolean | FunctionBasedParamter;
easing?: EasingOptions | string | ReadonlyArray<number>;
begin?: AnimeCallbackFunction;
run?: AnimeCallbackFunction;
update?: AnimeCallbackFunction;
complete?: AnimeCallbackFunction;
[AnyAnimatedProperty: string]: any;
}
interface AnimeParams extends AnimeInstanceParams, AnimeAnimParams {
// Just need this to merge both Params interfaces.
}
interface AnimeInstance {
play(): void;
pause(): void;
restart(): void;
reverse(): void;
seek(time: number): void;
began: boolean;
paused: boolean;
completed: boolean;
finished: Promise<void>;
begin: AnimeCallbackFunction;
run: AnimeCallbackFunction;
update: AnimeCallbackFunction;
complete: AnimeCallbackFunction;
autoplay: boolean;
currentTime: number;
delay: number;
direction: string;
duration: number;
loop: number | boolean;
offset: number;
progress: number;
remaining: number;
reversed: boolean;
animatables: ReadonlyArray<object>;
animations: ReadonlyArray<object>;
}
interface AnimeTimelineAnimParams extends AnimeAnimParams {
offset: number | string | FunctionBasedParamter;
}
interface AnimeTimelineInstance extends AnimeInstance {
add(params: AnimeAnimParams): AnimeTimelineInstance;
}
// Helpers
const speed: number;
const running: AnimeInstance[];
const easings: { [EasingFunction: string]: (t: number) => any };
function remove(targets: AnimeTarget | ReadonlyArray<AnimeTarget>): void;
function getValue(targets: AnimeTarget, prop: string): string | number;
function path(path: string | HTMLElement | SVGElement | null, percent?: number): (prop: string) => {
el: HTMLElement | SVGElement,
property: string,
totalLength: number
};
function setDashoffset(el: HTMLElement | SVGElement | null): number;
function bezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number;
// Timeline
function timeline(params?: AnimeInstanceParams | ReadonlyArray<AnimeInstance>): AnimeTimelineInstance;
function random(min: number, max: number): number;
}
declare function anime(params: anime.AnimeParams): anime.AnimeInstance;
export = anime;
export as namespace anime;

View File

@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"typescript-stl-tests.ts"
"animejs-tests.ts"
]
}
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -130,7 +130,10 @@ webAuth.signupAndAuthorize({
connection: 'the_connection',
email: 'me@example.com',
password: '123456',
scope: 'openid'
scope: 'openid',
user_metadata: {
foo: 'bar'
}
}, function (err, data) {
});

View File

@@ -1,6 +1,7 @@
// Type definitions for Auth0.js 8.6
// Project: https://github.com/auth0/auth0.js
// Definitions by: Adrian Chia <https://github.com/adrianchia>
// Matt Durrant <https://github.com/mdurrant>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace auth0;
@@ -624,6 +625,7 @@ interface DbSignUpOptions {
password: string;
connection: string;
scope?: string;
user_metadata?: any;
}
interface ParseHashOptions {

View File

@@ -35,7 +35,7 @@ new Awesomplete('input[type="email"]', {
"hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com",
"live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"],
data: (text: string, input: string) => {
return input.slice(0, input.indexOf("@")) + "@" + text;
return `${input.slice(0, input.indexOf("@"))}@${text}`;
},
filter: Awesomplete.FILTER_STARTSWITH
});
@@ -47,7 +47,7 @@ new Awesomplete('input[data-multiple]', {
replace: (text: string) => {
const before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
this.input.value = `${before}${text}, `;
}
});

View File

@@ -111,7 +111,7 @@ declare namespace Backbone {
/**
* Do not use, prefer TypeScript's extend functionality.
**/
private static extend(properties: any, classProperties?: any): any;
public static extend(properties: any, classProperties?: any): any;
attributes: any;
changed: any[];
@@ -205,7 +205,7 @@ declare namespace Backbone {
/**
* Do not use, prefer TypeScript's extend functionality.
**/
private static extend(properties: any, classProperties?: any): any;
public static extend(properties: any, classProperties?: any): any;
model: new (...args:any[]) => TModel;
models: TModel[];
@@ -322,7 +322,7 @@ declare namespace Backbone {
/**
* Do not use, prefer TypeScript's extend functionality.
**/
private static extend(properties: any, classProperties?: any): any;
public static extend(properties: any, classProperties?: any): any;
/**
* Routes hash or a method returning the routes hash that maps URLs with parameters to methods on your Router.
@@ -388,7 +388,7 @@ declare namespace Backbone {
/**
* Do not use, prefer TypeScript's extend functionality.
**/
private static extend(properties: any, classProperties?: any): any;
public static extend(properties: any, classProperties?: any): any;
constructor(options?: ViewOptions<TModel>);
initialize(options?: ViewOptions<TModel>): void;

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"callable-types": false
// TODOs
"callable-types": false,
"no-object-literal-type-assertion": false
}
}

View File

@@ -1,7 +1,7 @@
import * as Database from 'better-sqlite3';
let integer = Database.Integer(1);
let err = new Database.SqliteError('ok', 'ok');
const integer = Database.Integer(1);
const err = new Database.SqliteError('ok', 'ok');
let db = Database('.');
db = new Database('.', {memory: true});
@@ -15,7 +15,7 @@ db.register({name: 'noop', deterministic: true, varargs: true}, () => {});
db.defaultSafeIntegers();
db.defaultSafeIntegers(true);
let stmt = db.prepare('SELECT * FROM test WHERE name == ?;');
const stmt = db.prepare('SELECT * FROM test WHERE name == ?;');
stmt.get(['name']);
stmt.all({name: 'name'});
stmt.each('name', (row: {name: string}) => {});
@@ -26,7 +26,7 @@ stmt.bind('name');
stmt.safeIntegers();
stmt.safeIntegers(true);
let trans = db.transaction(['INSERT INTO test(name) VALUES(?);']);
const trans = db.transaction(['INSERT INTO test(name) VALUES(?);']);
trans.run('name');
trans.bind('name');
trans.run();

View File

@@ -1,6 +1,6 @@
// Type definitions for better-sqlite3 3.1
// Project: http://github.com/JoshuaWise/better-sqlite3
// Definitions by: Ben Davies <https://github.com/Morfent/>
// Definitions by: Ben Davies <https://github.com/Morfent>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -9,7 +9,7 @@ import * as Integer from 'integer';
interface RunResult {
changes: number;
lastInsertRowID: number;
lastInsertROWID: Integer.IntLike;
}
declare class Statement {
@@ -48,6 +48,7 @@ interface RegistrationOptions {
name?: string;
varargs?: boolean;
deterministic?: boolean;
safeIntegers?: boolean;
}
interface Database {

View File

@@ -53,7 +53,7 @@ describe('bitcoinjs-lib (basic)', () => {
const tx = new bitcoin.TransactionBuilder();
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
tx.addOutput(Buffer.from('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK'), 15000);
tx.sign(0, keyPair);
// tslint:disable-next-line:max-line-length

View File

@@ -208,7 +208,7 @@ export class TransactionBuilder {
addInput(txhash: Buffer | string | Transaction, vout: number, sequence?: number, prevOutScript?: Buffer): number;
addOutput(scriptPubKey: Buffer | string, value: number): number;
addOutput(scriptPubKey: Buffer, value: number): number;
build(): Transaction;
@@ -350,13 +350,13 @@ export const opcodes: {
};
export namespace address {
function fromBase58Check(address: string): Buffer;
function fromBase58Check(address: string): { hash: Buffer, version: number };
function fromOutputScript(outputScript: Buffer, network?: Network): Buffer;
function toBase58Check(hash: Buffer, version: number): string;
function toOutputScript(address: string, network?: Network): string;
function toOutputScript(address: string, network?: Network): Buffer;
}
export namespace bufferutils {
@@ -466,7 +466,7 @@ export namespace script {
output: {
check(script: Buffer): boolean;
decode(buffer: Buffer): Buffer;
encode(pubKeyHash: Buffer | number): Buffer;
encode(pubKeyHash: Buffer): Buffer;
};
};
@@ -504,7 +504,7 @@ export namespace script {
output: {
check(script: Buffer): boolean;
decode(buffer: Buffer): Buffer;
encode(pubKeyHash: Buffer | number): Buffer;
encode(pubKeyHash: Buffer): Buffer;
};
};

2
types/bl/index.d.ts vendored
View File

@@ -9,7 +9,7 @@
import stream = require('stream');
declare class BufferList extends stream.Duplex {
new(callback?: (err: Error, buffer: Buffer) => void): void;
constructor(callback?: (err: Error, buffer: Buffer) => void);
append(buffer: Buffer): void;
get(index: number): number;

View File

@@ -867,6 +867,10 @@ model.where('favorite_color', 'red').fetch().then(() => {
model.where({favorite_color: 'red', shoe_size: 12}).fetch().then(() => {
//...
});
// or
model.where('favorite_color', 'in', ['red', 'green']).fetch().then(() => {
// ...
});
/* Lodash methods, see http://bookshelfjs.org/#Model-subsection-lodash-methods */
@@ -1197,6 +1201,13 @@ ships.trigger('fetched');
/* collection.where(), see http://bookshelfjs.org/#Collection-instance-where */
(new Author())
.where('first_name', 'in', ['User', 'Resu'])
.fetchAll()
.then(() => {
// ...
})
/* collection.withPivot(), see http://bookshelfjs.org/#Collection-instance-withPivot */
{

View File

@@ -97,7 +97,7 @@ declare namespace Bookshelf {
/** @deprecated should use `new` objects instead. */
static forge<T>(attributes?: any, options?: ModelOptions): T;
static where<T>(properties: { [key: string]: any }): T;
static where<T>(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T;
static where<T>(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | string[] | number | number[] | boolean): T;
belongsTo<R extends Model<any>>(target: { new (...args: any[]): R }, foreignKey?: string, foreignKeyTarget?: string): R;
belongsToMany<R extends Model<any>>(target: { new (...args: any[]): R }, table?: string, foreignKey?: string, otherKey?: string, foreignKeyTarget?: string, otherKeyTarget?: string): Collection<R>;
@@ -126,7 +126,7 @@ declare namespace Bookshelf {
save(attrs?: { [key: string]: any }, options?: SaveOptions): BlueBird<T>;
through<R extends Model<any>>(interim: ModelSubclass, throughForeignKey?: string, otherKey?: string): R;
where(properties: { [key: string]: any }): T;
where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T;
where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | string[] | number | number[] | boolean): T;
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/errors.js
// See https://github.com/tgriesser/bookshelf/blob/0.9.4/src/model.js#L1280

View File

@@ -12,7 +12,7 @@ $(() => {
$('#ex2').slider({});
const RGBChange = () => {
$('#RGB').css('background', 'rgb(' + r.getValue() + ',' + g.getValue() + ',' + b.getValue() + ')');
$('#RGB').css('background', `rgb(${r.getValue()},${g.getValue()},${b.getValue()})`);
};
const r = $('#R').slider()

View File

@@ -508,6 +508,7 @@ export interface Client extends events.EventEmitter {
batch(queries: Array<string> | Array<{ query: string, params?: any }>, options: QueryOptions, callback: ResultCallback): void;
connect(callback: Callback): void;
eachRow(query: string, params?: any, options?: QueryOptions, rowCallback?: Callback, callback?: Callback): void;
execute(query: string, params?: any, callback?: ResultCallback): void;
execute(query: string, params?: any, options?: QueryOptions, callback?: ResultCallback): void;
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
shutdown(callback?: Callback): void;

View File

@@ -6,7 +6,7 @@ import { Chart, ChartData } from 'chart.js';
const chart: Chart = new Chart(new CanvasRenderingContext2D(), {
type: 'bar',
data: <ChartData> {
data: {
labels: ['group 1'],
datasets: [
{

View File

@@ -57,7 +57,7 @@ historyApiFallback({
{
from: /^\/libs\/(.*)$/,
to(context) {
return '/' + context.match[2] + '/' + context.match[3];
return `/${context.match[2]}/${context.match[3]}`;
}
}
]

View File

@@ -104,13 +104,13 @@ function sampleWithPRAGMA() {
});
tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], (tx, res) => {
console.log("insertId: " + res.insertId + " -- probably 1");
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
console.log(`insertId: ${res.insertId} -- probably 1`);
console.log(`rowsAffected: ${res.rowsAffected} -- should be 1`);
db.transaction(tx => {
tx.executeSql("select count(id) as cnt from test_table;", [], (tx, res) => {
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
console.log(`res.rows.length: ${res.rows.length} -- should be 1`);
console.log(`res.rows.item(0).cnt: ${res.rows.item(0).cnt} -- should be 1`);
});
});
@@ -135,12 +135,12 @@ function sampleWithTransactionLevelNesting() {
tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id integer primary key, data text, data_num integer)');
tx.executeSql("INSERT INTO test_table (data, data_num) VALUES (?,?)", ["test", 100], (tx, res) => {
console.log("insertId: " + res.insertId + " -- probably 1");
console.log("rowsAffected: " + res.rowsAffected + " -- should be 1");
console.log(`insertId: ${res.insertId} -- probably 1`);
console.log(`rowsAffected: ${res.rowsAffected} -- should be 1`);
tx.executeSql("select count(id) as cnt from test_table;", [], (tx, res) => {
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
console.log(`res.rows.length: ${res.rows.length} -- should be 1`);
console.log(`res.rows.item(0).cnt: ${res.rows.item(0).cnt} -- should be 1`);
});
}, (tx, e) => {
console.log("ERROR: " + e.message);

View File

@@ -59,7 +59,7 @@ let dictOfAny: Dict<any>;
// es6.object.to-string, es6.function.name and es6.function.has-instance.
// #############################################################################################
point = Object.assign(point, point);
point = Object.assign(point, point); // tslint:disable-line prefer-object-spread
b = Object.is(point, point);
Object.setPrototypeOf(point, point);
s = f.name;

View File

@@ -1,15 +1,15 @@
import CryptoJS = require('crypto-js');
// Hashers
var str: string;
str = CryptoJS.MD5('some message');
str = CryptoJS.MD5('some message', 'some key');
var wordArray: CryptoJS.WordArray;
wordArray = CryptoJS.MD5('some message');
wordArray = CryptoJS.MD5('some message', 'some key');
str = CryptoJS.SHA1('some message');
str = CryptoJS.SHA1('some message', 'some key', { any: true });
wordArray = CryptoJS.SHA1('some message');
wordArray = CryptoJS.SHA1('some message', 'some key', { any: true });
str = CryptoJS.format.OpenSSL('some message');
str = CryptoJS.format.OpenSSL('some message', 'some key');
wordArray = CryptoJS.format.OpenSSL('some message');
wordArray = CryptoJS.format.OpenSSL('some message', 'some key');
// Ciphers

View File

@@ -1,4 +1,4 @@
// Type definitions for crypto-js v3.1.4
// Type definitions for crypto-js v3.1.8
// Project: https://github.com/evanvosberg/crypto-js
// Definitions by: Michael Zabka <https://github.com/misak113>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -8,7 +8,7 @@ export as namespace CryptoJS;
declare var CryptoJS: CryptoJS.Hashes;
declare namespace CryptoJS {
type Hash = (message: string, key?: string, ...options: any[]) => string;
type Hash = (message: string, key?: string, ...options: any[]) => WordArray;
interface Cipher {
encrypt(message: string, secretPassphrase: string, option?: CipherOption): WordArray;
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string, option?: CipherOption): DecryptedMessage;
@@ -30,6 +30,7 @@ declare namespace CryptoJS {
salt: string;
ciphertext: string;
key?: string;
toString(encoder?: Encoder): string;
}
export type DecryptedMessage = {
toString(encoder?: Encoder): string;

View File

@@ -52,15 +52,15 @@ import PadZeroPadding = require('../pad-zeropadding');
import PadNoPadding = require('../pad-nopadding');
// Hashers
var str: string;
str = MD5('some message');
str = MD5('some message', 'some key');
var wordArray: CryptoJS.WordArray;
wordArray = MD5('some message');
wordArray = MD5('some message', 'some key');
str = SHA1('some message');
str = SHA1('some message', 'some key', { any: true });
wordArray = SHA1('some message');
wordArray = SHA1('some message', 'some key', { any: true });
str = FormatOpenSSL('some message');
str = FormatOpenSSL('some message', 'some key');
wordArray = FormatOpenSSL('some message');
wordArray = FormatOpenSSL('some message', 'some key');
// Ciphers

View File

@@ -21,9 +21,11 @@ function StepSample(this: cucumber.StepDefinitions & cucumber.Hooks) {
});
hook.Around((scenario: HookScenario, runScenario: (error: string | null, callback?: () => void) => void) => {
scenario.isFailed() && runScenario(null, () => {
console.log('finish tasks');
});
if (scenario.isFailed()) {
runScenario(null, () => {
console.log('finish tasks');
});
}
});
hook.registerHandler('AfterFeatures', (event: any, callback: () => void) => {
@@ -91,7 +93,7 @@ function StepSample(this: cucumber.StepDefinitions & cucumber.Hooks) {
}
function registerListener(): cucumber.EventListener {
let listener = Object.assign(cucumber.Listener(), {
const listener = Object.assign(cucumber.Listener(), {
handleBeforeScenarioEvent(scenario: cucumber.events.ScenarioPayload, callback: () => void) {
// do some interesting stuff ...

View File

@@ -66,7 +66,7 @@ tape("binary", (t) => {
const binary = cwise({
args: ["array", "array", "scalar", "shape", "index"],
body(a: number, b: number, t: tape.Test, s: number[], idx: number) {
if (!(a === 0)) t.fail("idx:" + idx + ", shape:" + s + ",a:" + a);
if (!(a === 0)) t.fail(`idx:${idx}, shape:${s},a:${a}`);
a = b + 1001;
}
});
@@ -80,7 +80,7 @@ tape("binary", (t) => {
binary(P, Q, t);
for (let i = 0; i < P.shape[0]; ++i) {
if (!(P.get(i) === i + 1001)) {
t.fail(testName + "; encountered " + P.get(i) + " instead of " + (i + 1001) + " at " + i);
t.fail(`${testName}; encountered ${P.get(i)} instead of ${(i + 1001)} at ${i}`);
return;
}
}
@@ -128,7 +128,7 @@ tape("binary", (t) => {
for (let i = 0; i < P.shape[0]; ++i) {
for (let j = 0; j < P.shape[1]; ++j) {
if (!(P.get(i, j) === i * 1000 + j + 1001)) {
t.fail(testName + "; encountered " + P.get(i, j) + " instead of " + (i * 1000 + j + 1001) + " at (" + i + "," + j + ")");
t.fail(`${testName}; encountered ${P.get(i, j)} instead of ${(i * 1000 + j + 1001)} at (" + i + "," + j + ")`);
return;
}
}
@@ -163,7 +163,7 @@ function bundleCasesFrom(i: number) {
if (i >= cases.length) return;
const b = browserify();
b.ignore("tape");
b.add(__dirname + "/" + cases[i] + ".js");
b.add(`${__dirname}/${cases[i]}.js`);
b.transform(path.normalize(__dirname + "/../cwise.js"));
tape(cases[i], (t) => { // Without nested tests, the asynchronous nature of bundle causes issues with tape...
b.bundle((err, src) => {
@@ -209,7 +209,7 @@ tape("fill", (t) => {
for (let i = 0; i < xlen; i++) {
for (let j = 0; j < ylen; j++) {
t.equals(array.get(i, j), 0, 'fill (' + i + ',' + j + ')');
t.equals(array.get(i, j), 0, `fill (${i},${j})`);
}
}
@@ -219,7 +219,7 @@ tape("fill", (t) => {
for (let i = 0; i < xlen; i++) {
for (let j = 0; j < ylen; j++) {
t.equals(array.get(i, j), 10 * (i + j), 'fill (' + i + ',' + j + ')');
t.equals(array.get(i, j), 10 * (i + j), `fill (${i},${j})`);
}
}
@@ -231,7 +231,7 @@ tape("offset", (t) => {
const binary = cwise({
args: ["array", "array", { offset: [1], array: 1 }, "scalar", "shape", "index"],
body(a, b, c, t, s, idx) {
if (!(a === 0)) t.fail("idx:" + idx + ", shape:" + s + ",a:" + a);
if (!(a === 0)) t.fail(`idx:${idx}, shape:${s},a:${a}`);
a = c + b + 1000;
}
});
@@ -246,7 +246,7 @@ tape("offset", (t) => {
binary(P, Q.hi(Q.shape[0] - 1), t);
for (let i = 0; i < P.shape[0]; ++i) {
if (!(P.get(i) === 2 * i + 1001)) {
t.fail(testName + "; encountered " + P.get(i) + " instead of " + (2 * i + 1001) + " at " + i);
t.fail(`${testName}; encountered ${P.get(i)} instead of ${2 * i + 1001} at ${i}`);
return;
}
}
@@ -292,7 +292,7 @@ tape("unary", (t) => {
unary(arr);
for (let i = 0; i < arr.shape[0]; ++i) {
if (!(arr.get(i) === i + 1)) {
t.fail(testName + "; encountered " + arr.get(i) + " instead of " + (i + 1) + " at " + i);
t.fail(`${testName}; encountered ${arr.get(i)} instead of ${i + 1} at ${i}`);
return;
}
}
@@ -336,7 +336,7 @@ tape("unary", (t) => {
for (let i = 0; i < arr.shape[0]; ++i) {
for (let j = 0; j < arr.shape[1]; ++j) {
if (!(arr.get(i, j) === 1 + i + j * arr.shape[0])) {
t.fail(testName + "; encountered " + arr.get(i, j) + " instead of " + (1 + i + j * arr.shape[0]) + " at (" + i + "," + j + ")");
t.fail(`${testName}; encountered ${arr.get(i, j)} instead of ${1 + i + j * arr.shape[0]} at (${i},${j})`);
return;
}
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false
}
}

View File

@@ -1 +1,7 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"dt-header": false
}
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false
}
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false,
"max-line-length": [false, 200]
}

View File

@@ -29,7 +29,7 @@ qWithResults = d3Queue.queue(3);
function delayedHello(name: string, delay: number, callback: (error: any | null) => void) {
setTimeout(() => {
console.log('Hello, ' + name + '!');
console.log(`Hello, ${name}!`);
callback(null);
}, delay);
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false
}
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false,
"max-line-length": [false, 145]
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false
}
}

View File

@@ -484,7 +484,7 @@ body = body
const datum: BodyDatum = d;
const index: number = i;
const group: HTMLBodyElement[] | d3Selection.ArrayLike<HTMLBodyElement> = g;
return '<div> Body Background Color: ' + this.bgColor + ', Foo Datum: ' + d.foo + '</div>'; // this context HTMLBodyElement, datum BodyDatum
return `<div> Body Background Color: ${this.bgColor}, Foo Datum: ${d.foo}</div>`; // this context HTMLBodyElement, datum BodyDatum
});
// ---------------------------------------------------------------------------------------
@@ -993,7 +993,7 @@ let customListener: (this: HTMLBodyElement, finalOpponent: string) => string;
customListener = finalOpponent => {
const e = <SuccessEvent> d3Selection.event;
return e.team + ' defeated ' + finalOpponent + ' in the EURO 2016 Cup. Who would have thought!!!';
return `${e.team} defeated ${finalOpponent} in the EURO 2016 Cup. Who would have thought!!!`;
};
const resultText: string = d3Selection.customEvent(successEvent, customListener, body.node(), 'Wales');

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false
}
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false,
"callable-types": false
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false
}
}

View File

@@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODO
"no-this-assignment": false,
"unified-signatures": false
}
}

View File

@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"dt-header": false
}
}

View File

@@ -0,0 +1,9 @@
import destroy = require('destroy');
import * as fs from 'fs';
const stream = fs.createReadStream('package.json');
// $ExpectType ReadStream
destroy(stream);
// $ExpectType WriteStream
destroy(process.stderr);

11
types/destroy/index.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
// Type definitions for destroy 1.0
// Project: https://github.com/stream-utils/destroy
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Stream } from 'stream';
export = destroy;
declare function destroy<T extends Stream>(stream: T): T;

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"destroy-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1,6 +1,6 @@
import di = require('detect-indent');
let str: string = '';
let str = '';
str = di(str);
str = di(str, str);

View File

@@ -7,13 +7,13 @@ interface Dependency {
function doTest(test: (ctx: any, ...obj: Dependency[]) => void) {
// create di context
var ctx = di.createContext(),
A: Dependency = () => {
this.dependencies = "b, c";
A: Dependency = {
dependencies: "b, c",
},
B: Dependency = () => {
this.dependencies = "c";
B: Dependency = {
dependencies: "c",
},
C: Dependency = () => {};
C: Dependency = {};
// register a class with an unique name
ctx.register("a", A);

View File

@@ -7,7 +7,7 @@ let diff = jsdiff.diffChars(one, other);
diff.forEach(part => {
const mark = part.added ? '+' :
part.removed ? '-' : ' ';
console.log(mark + " " + part.value);
console.log(`${mark} ${part.value}`);
});
// --------------------------

View File

@@ -20,10 +20,12 @@ function filter() {
.value();
if (!result.isAccepted) throw new Error("The call was not accepted");
// Example 3: get document (person) with id = 1 and delete it.
var result: IQueryResponse = __.filter(function (doc: any) { return doc.id === 1; }, function (err: IFeedCallbackError, feed: Array<any>, options: IFeedCallbackOptions) {
if (err) throw err;
if (!__.deleteDocument(feed[0].getSelfLink())) throw new Error("deleteDocument was not accepted");
});
var result: IQueryResponse = __.filter(
function (doc: any) { return doc.id === 1; },
function (err: IFeedCallbackError, feed: Array<any>, options: IFeedCallbackOptions) {
if (err) throw err;
if (!__.deleteDocument(feed[0].getSelfLink())) throw new Error("deleteDocument was not accepted");
});
if (!result.isAccepted) throw new Error("The call was not accepted");
}
function flatten() {
@@ -103,7 +105,7 @@ function value() {
// Samples taken from https://github.com/Azure/azure-documentdb-js-server/tree/master/samples
/**
* This script called as stored procedure to import lots of documents in one batch.
* The script sets response body to the number of docs imported and is called multiple times
* The script sets response body to the number of docs imported and is called multiple times
* by the client until total number of docs desired by the client is imported.
* @param {Object[]} docs - Array of documents to import.
*/
@@ -127,7 +129,7 @@ function bulkImport(docs: Array<Object>) {
tryCreate(docs[count], callback);
// Note that there are 2 exit conditions:
// 1) The createDocument request was not accepted.
// 1) The createDocument request was not accepted.
// In this case the callback will not be called, we just call setBody and we are done.
// 2) The callback was called docs.length times.
// In this case all documents were created and we don't need to call tryCreate anymore. Just call setBody and we are done.
@@ -135,7 +137,7 @@ function bulkImport(docs: Array<Object>) {
var isAccepted = collection.createDocument(collectionLink, doc, callback);
// If the request was accepted, callback will be called.
// Otherwise report current count back to the client,
// Otherwise report current count back to the client,
// which will call the script again with remaining set of docs.
// This condition will happen when this stored procedure has been running too long
// and is about to get cancelled by the server. This will allow the calling client
@@ -164,7 +166,7 @@ function bulkImport(docs: Array<Object>) {
* This is executed as stored procedure to count the number of docs in the collection.
* To avoid script timeout on the server when there are lots of documents (100K+), the script executed in batches,
* each batch counts docs to some number and returns continuation token.
* The script is run multiple times, starting from empty continuation,
* The script is run multiple times, starting from empty continuation,
* then using continuation returned by last invocation script until continuation returned by the script is null/empty string.
*
* @param {String} filterQuery - Optional filter for query (e.g. "SELECT * FROM docs WHERE docs.category = 'food'").
@@ -172,7 +174,7 @@ function bulkImport(docs: Array<Object>) {
*/
function count(filterQuery: string, continuationToken: string) {
var collection: ICollection = getContext().getCollection();
var maxResult: number = 25; // MAX number of docs to process in one batch, when reached, return to client/request continuation.
var maxResult: number = 25; // MAX number of docs to process in one batch, when reached, return to client/request continuation.
// intentionally set low to demonstrate the concept. This can be much higher. Try experimenting.
// We've had it in to the high thousands before seeing the stored proceudre timing out.
@@ -186,7 +188,7 @@ function count(filterQuery: string, continuationToken: string) {
var responseOptions: Object = { continuation: nextContinuationToken, pageSize: maxResult };
// In case the server is running this script for long time/near timeout, it would return false,
// in this case we set the response to current continuation token,
// in this case we set the response to current continuation token,
// and the client will run this script again starting from this continuation.
// When the client calls this script 1st time, is passes empty continuation token.
if (result >= maxResult || !query(responseOptions)) {
@@ -210,7 +212,7 @@ function count(filterQuery: string, continuationToken: string) {
// Increament the number of documents counted so far.
result += docFeed.length;
// If there is continuation, call query again with it,
// If there is continuation, call query again with it,
// otherwise we are done, in which case set continuation to null.
if (responseOptions.continuation) {
tryQuery(responseOptions.continuation);
@@ -324,7 +326,7 @@ function orderBy(filterQuery: string, orderByFieldName: string, continuationToke
break;
}
}
// Now next batch to return to client has i elements.
// Slice the continuationResult if needed and discard the end.
var partialResult: Array<any> = continuationResult;
@@ -341,7 +343,7 @@ function orderBy(filterQuery: string, orderByFieldName: string, continuationToke
/**
* This is run as stored procedure and does the following:
* - get 1st document in the collection, convert to JSON, prepend string specified by the prefix parameter
* - get 1st document in the collection, convert to JSON, prepend string specified by the prefix parameter
* and set response to the result of that.
*
* @param {String} prefix - The string to prepend to the 1st document in collection.
@@ -750,8 +752,8 @@ function updateSproc(id: string, update: Object) {
/**
* A DocumentDB stored procedure that upserts a given document (insert new or update if present) using its id property.<br/>
* This implementation tries to create, and if the create fails then query for the document with the specified document's id, then replace it.
* Use this sproc if creates are more common than replaces, otherwise use "upsertOptimizedForReplace"
* This implementation tries to create, and if the create fails then query for the document with the specified document's id, then replace it.
* Use this sproc if creates are more common than replaces, otherwise use "upsertOptimizedForReplace"
*
* @function
* @param {Object} document - A document that should be upserted into this collection.
@@ -820,7 +822,7 @@ function upsert(document: IDocumentMeta) {
/**
* A DocumentDB stored procedure that upserts a given document (insert new or update if present) using its id property.<br/>
* This implementation queries for the document's id, and creates if absent and replaces if found.
* Use this sproc if replaces are more common than creates, otherwise use "upsert"
* Use this sproc if replaces are more common than creates, otherwise use "upsert"
*
* @function
* @param {Object} document - A document that should be upserted into this collection.
@@ -941,17 +943,17 @@ function updateMetadata() {
// for 1st document use doc.Size, for all the rest see if it's less than last min.
if (metaDoc.minSize == 0) metaDoc.minSize = doc.size;
else metaDoc.minSize = Math.min(metaDoc.minSize, doc.size);
// Update metaDoc.maxSize.
metaDoc.maxSize = Math.max(metaDoc.maxSize, doc.size);
// Update metaDoc.totalSize.
metaDoc.totalSize += doc.size;
// Update/replace the metadata document in the store.
var isAccepted: boolean = collection.replaceDocument(metaDoc._self, metaDoc, function (err: IRequestCallbackError) {
if (err) throw err;
// Note: in case concurrent updates causes conflict with ErrorCode.RETRY_WITH, we can't read the meta again
// Note: in case concurrent updates causes conflict with ErrorCode.RETRY_WITH, we can't read the meta again
// and update again because due to Snapshot isolation we will read same exact version (we are in same transaction).
// We have to take care of that on the client side.
});

View File

@@ -36,6 +36,8 @@ interface IQueryAPI {
* @param options Optional query options. Should not be used in a chained call.
* @param callback Optional callback for the operation. If no callback is provided, any error in the operation will be thrown and the result document set will be written to the Response body. Should not be used in a chained call.
*/
filter(predicate: (document: Object) => boolean,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
filter(predicate: (document: Object) => boolean,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
@@ -49,6 +51,8 @@ interface IQueryAPI {
* @param options Optional query options. Should not be used in a chained call.
* @param callback Optional callback for the operation. If no callback is provided, any error in the operation will be thrown and the result document set will be written to the Response body. Should not be used in a chained call.
*/
map(predicate: (document: Object) => Object,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
map(predicate: (document: Object) => Object,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
@@ -62,6 +66,8 @@ interface IQueryAPI {
* @param options Optional query options. Should not be used in a chained call.
* @param callback Optional callback for the operation. If no callback is provided, any error in the operation will be thrown and the result document set will be written to the Response body. Should not be used in a chained call.
*/
pluck(propertyName: string,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
pluck(propertyName: string,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
@@ -75,6 +81,8 @@ interface IQueryAPI {
* @param options Optional query options. Should not be used in a chained call.
* @param callback Optional callback for the operation. If no callback is provided, any error in the operation will be thrown and the result document set will be written to the Response body. Should not be used in a chained call.
*/
flatten(isShallow?: boolean,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
flatten(isShallow?: boolean,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
@@ -88,16 +96,12 @@ interface IQueryAPI {
* @param options Optional query options. Should not be used in a chained call.
* @param Optional callback for the operation. If no callback is provided, any error in the operation will be thrown and the result document set will be written to the Response body. Should not be used in a chained call.
*/
sortBy(predicate: (document: Object) => string,
sortBy(predicate: (document: Object) => string | number,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortBy(predicate: (document: Object) => string | number,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortBy(predicate: (document: Object) => number,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortBy<T>(predicate: (document: Object) => string,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortBy<T>(predicate: (document: Object) => number,
sortBy<T>(predicate: (document: Object) => string | number,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): IQueryResponse;
/**
@@ -107,16 +111,12 @@ interface IQueryAPI {
* @param options Optional query options. Should not be used in a chained call.
* @param callback Optional callback for the operation. If no callback is provided, any error in the operation will be thrown and the result document set will be written to the Response body. Should not be used in a chained call.
*/
sortByDescending(predicate: (document: Object) => string,
sortByDescending(predicate: (document: Object) => string | number,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortByDescending(predicate: (document: Object) => string | number,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortByDescending(predicate: (document: Object) => number,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortByDescending<T>(predicate: (document: Object) => string,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): IQueryResponse;
sortByDescending<T>(predicate: (document: Object) => number,
sortByDescending<T>(predicate: (document: Object) => string | number,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): IQueryResponse;
/**
@@ -125,19 +125,20 @@ interface IQueryAPI {
* @param options Optional query options for the entire chained call.
* @param callback Optional callback for the operation. If no callback is provided, any error in the operation will be thrown and the result document set will be written to the Response body.
*/
value(callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
value(options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): IQueryResponse;
value<T>(options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): IQueryResponse;
}
/**
* Stored procedures and triggers are registered for a particular collection. The Collection object supports create, read, update and delete (CRUD) and query operations on documents and attachments in the current collection.
* All collection operations are completed asynchronously. You can provide a callback to handle the result of the operation, and to perform error handling if necessary.
* Stored procedures and triggers are executed in a time-limited manner. Long-running stored procedures and triggers are defensively timed out and all transactions performed are rolled back.
* We stop queuing collection operations if the stored procedure is close to timing out. You can inspect the boolean return value of all collection operations to see if an operation was not queued and handle this situation gracefully.
*/
interface ICollection extends IQueryAPI {
interface ICollection extends IQueryAPI {
/** Opening call to start a chained query. Should be used in conjunction with the closing value call to perform chained queries. */
chain(): IQueryResponse;
@@ -148,11 +149,14 @@ interface ICollection extends IQueryAPI {
* @param options optional create options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
createAttachment(documentLink: string,
body: IAttachment,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
createAttachment(documentLink: string,
body: IAttachment,
options?: ICreateOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
/**
* Create a document under the collection.
* @param collectionLink resource link of the collection under which the document will be created
@@ -160,37 +164,44 @@ interface ICollection extends IQueryAPI {
* @param optional create options
* @param optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
createDocument(collectionLink: string,
body: Object,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
createDocument(collectionLink: string,
body: Object,
options?: ICreateOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
/**
* Delete an attachment.
* @param attachmentLink resource link of the attachment to be deleted
* @param options optional delete options.
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
deleteAttachment(attachmentLink: string,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
deleteAttachment(attachmentLink: string,
options?: IDeleteOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
/**
* Delete a document.
* @param documentLink resource link of the document to delete
* @param options optional delete options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
deleteDocument(documentLink: string,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
deleteDocument(documentLink: string,
options?: IDeleteOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
/** Get alt link (name-based link) of current collection. */
getAltLink(): string;
/** Get self link of current collection. */
getSelfLink(): string;
/**
* Execute a SQL query on the attachments for the document.
* @param documentLink resource link of the document whose attachments are being queried
@@ -199,14 +210,13 @@ interface ICollection extends IQueryAPI {
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
queryAttachments(documentLink: string,
query: string,
options?: IFeedOptions,
query: string | IParameterizedQuery,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
queryAttachments(documentLink: string,
query: IParameterizedQuery,
query: string | IParameterizedQuery,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
/**
* Execute a SQL query on the documents of the collection.
* @param collectionLink resource link of the collection whose documents are being queried
@@ -214,6 +224,9 @@ interface ICollection extends IQueryAPI {
* @param options optional query options.
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
queryDocuments(collectionLink: string,
filterQuery: string,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
queryDocuments(collectionLink: string,
filterQuery: string,
options?: IFeedOptions,
@@ -222,6 +235,9 @@ interface ICollection extends IQueryAPI {
filterQuery: string,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): boolean;
queryDocuments(collectionLink: string,
filterQuery: IParameterizedQuery,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
queryDocuments(collectionLink: string,
filterQuery: IParameterizedQuery,
options?: IFeedOptions,
@@ -230,53 +246,61 @@ interface ICollection extends IQueryAPI {
filterQuery: IParameterizedQuery,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): boolean;
/**
* Read an Attachment.
* @param attachmenLink resource link of the attachment to read
* @param options optional read options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
readAttachment(attachmenLink: string,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
readAttachment(attachmenLink: string,
options?: IReadOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
/**
* Get all attachments for the document.
* @param documentLink resource link of the document whose attachments are being read
* @param options optional read feed options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
readAttachments(documentLink: string,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
readAttachments(documentLink: string,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
/**
* Read a document.
* @param documentLink resource link of the document to read
* @param options optional read options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
readDocument(documentLink: string,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
readDocument(documentLink: string,
options?: IReadOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
readDocument<T>(documentLink: string,
options?: IReadOptions,
callback?: (error: IRequestCallbackError, resources: T, options: IRequestCallbackOptions) => void): boolean;
/**
* Get all documents for the collection.
* @param collectionLink resource link of the collection whose documents are being read
* @param options optional read feed options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
readDocuments(collectionLink: string,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
readDocuments(collectionLink: string,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<Object>, options: IFeedCallbackOptions) => void): boolean;
readDocuments<T>(collectionLink: string,
options?: IFeedOptions,
callback?: (error: IFeedCallbackError, resources: Array<T>, options: IFeedCallbackOptions) => void): boolean;
/**
* Replace an attachment.
* @param attachmentLink resource link of the attachment to be replaced
@@ -284,11 +308,14 @@ interface ICollection extends IQueryAPI {
* @param options optional replace options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
replaceAttachment(attachmentLink: string,
attachment: Object,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
replaceAttachment(attachmentLink: string,
attachment: Object,
options?: IReplaceOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
/**
* Replace a document.
* @param documentLink resource link of the document
@@ -296,12 +323,15 @@ interface ICollection extends IQueryAPI {
* @param options optional replace options
* @param callback optional callback for the operation. If no callback is provided, any error in the operation will be thrown.
*/
replaceDocument(documentLink: string,
document: Object,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
replaceDocument(documentLink: string,
document: Object,
options?: IReplaceOptions,
callback?: (error: IRequestCallbackError, resources: Object, options: IRequestCallbackOptions) => void): boolean;
}
/** Options associated with a create operation. */
interface ICreateOptions {
/** Specifies indexing directives. */
@@ -309,7 +339,7 @@ interface ICreateOptions {
/** Disables automatic generation of "id" field of the document to be created (if it is not provided) */
disableAutomaticIdGeneration?: string;
}
/** Options associated with a delete operation. */
interface IDeleteOptions {
/**
@@ -318,7 +348,7 @@ interface IDeleteOptions {
*/
etag?: string;
}
/** Will contain error information if an error occurs, undefined otherwise. */
interface IFeedCallbackError {
/** The HTTP response code corresponding to the error. */
@@ -326,7 +356,7 @@ interface IFeedCallbackError {
/** A string containing the error information. */
body: string;
}
/** Information associated with the response to the operation. */
interface IFeedCallbackOptions {
/** Opaque token for continuing the read feed or query. */
@@ -336,7 +366,7 @@ interface IFeedCallbackOptions {
/** Comma delimited string containing the collection's maximum quota metrics (storage, number of stored procedure, triggers and UDFs). */
maxCollectionSizeInMB: string;
}
/** Options associated with a read feed or query operation. */
interface IFeedOptions {
/**
@@ -360,13 +390,13 @@ interface IQueryResponse extends IQueryAPI {
/** True if the query has been queued, false if it is not queued because of a pending timeout. */
isAccepted: boolean;
}
/** Options associated with a read operation. */
interface IReadOptions {
/** The conditional HTTP method ifNoneMatch value. */
ifNoneMatch?: string;
}
/** Options associated with a replace operation. */
interface IReplaceOptions {
/** Specifies indexing directives. */
@@ -377,7 +407,7 @@ interface IReplaceOptions {
*/
etag?: string;
}
/** Will contain error information if an error occurs, undefined otherwise. */
interface IRequestCallbackError {
/** The HTTP response code corresponding to the error. */
@@ -385,7 +415,7 @@ interface IRequestCallbackError {
/** A string containing the error information. */
body: string;
}
/** Information associated with the response to the operation. */
interface IRequestCallbackOptions {
/** Comma delimited string containing the collection's current quota metrics (storage, number of stored procedure, triggers and UDFs) after completion of the operation. */
@@ -411,7 +441,7 @@ interface IDocumentMeta extends Object {
_etag?: string;
_attachments?: string;
}
/**
* The Request object represents the request message that was sent to the server. This includes information about HTTP headers and the body of the HTTP request sent to the server.
* For triggers, the request represents the operation that is executing when the trigger is run. For example, if the trigger is being run ("triggered") on the creation of a document, then
@@ -445,7 +475,7 @@ interface IRequest {
*/
setValue(key: string, value: string): void;
}
/**
* The Response object represents the response message that will be sent from the server in response to the requested operation. This includes information about the HTTP headers and body of the response from the server.
* The Response object is not present in pre-triggers because they are run before the response is generated.

View File

@@ -23,8 +23,8 @@ declare namespace dojox {
*
*
*/
class object {
constructor();
const object: { new(): objectInstance };
interface objectInstance {
/**
* multiplies the existing matrix with an argument on left side
* (matrix * this.matrix)
@@ -2529,7 +2529,7 @@ declare namespace dojox {
* @param outline
*/
class BinarySearchTree {
constructor(obj: dojox.gfx3d.object, outline: any);
constructor(obj: dojox.gfx3d.objectInstance, outline: any);
/**
*
* @param obj
@@ -3240,7 +3240,7 @@ declare module "dojox/gfx3d" {
export=exp;
}
declare module "dojox/gfx3d/object" {
var exp: dojox.gfx3d.object
var exp: dojox.gfx3d.objectInstance;
export=exp;
}
declare module "dojox/gfx3d/gradient" {

View File

@@ -6293,7 +6293,7 @@ declare namespace dojox {
*
*
*/
interface object {
interface objectInstance {
/**
* builds a function from a snippet, returns a string, which
* represents the function.
@@ -12082,7 +12082,7 @@ declare module "dojox/lang/functional/listcomp" {
export=exp;
}
declare module "dojox/lang/functional/object" {
var exp: dojox.lang.functional.object
var exp: dojox.lang.functional.objectInstance
export=exp;
}
declare module "dojox/lang/functional/zip" {

View File

@@ -1,18 +1,18 @@
const headertmpl = "<h1>{{=it.title}}</h1>";
const pagetmpl = "<h2>Here is the page using a header template< / h2 >\n"
+ "{{#def.header}}\n"
+ "{{=it.name}}";
const pagetmpl = `<h2>Here is the page using a header template< / h2 >
{{#def.header}}
{{=it.name}}`;
const customizableheadertmpl = "{{#def.header}}"
+ "\n{{#def.mycustominjectionintoheader || ''} }";
const customizableheadertmpl = `{{#def.header}}
{{#def.mycustominjectionintoheader || ''} }`;
const pagetmplwithcustomizableheader = "<h2>Here is the page with customized header template</h2>\n"
+ "{{##def.mycustominjectionintoheader:\n"
+ " <div>{{=it.title}} is not {{=it.name}}</div>\n"
+ "#}}\n"
+ "{{#def.customheader}}\n"
+ "{{=it.name}}";
const pagetmplwithcustomizableheader = `<h2>Here is the page with customized header template</h2>
{{##def.mycustominjectionintoheader:
<div>{{=it.title}} is not {{=it.name}}</div>
#}}
{{#def.customheader}}
{{=it.name}}`;
const def = {
header: headertmpl,

View File

@@ -1,6 +1,6 @@
// Type definitions for dotenv 2.0
// Project: https://github.com/motdotla/dotenv
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula/>, Borek Bernard <https://github.com/borekb>, Eric Naeseth <https://github.com/enaeseth>
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula>, Borek Bernard <https://github.com/borekb>, Eric Naeseth <https://github.com/enaeseth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />

View File

@@ -79,7 +79,7 @@ const selectOptions: DropkickOptions = {
open(this: Dropkick) {
const optionsList = (<any> this).data.elem.lastChild; // undocumented but useful data field
if (optionsList.scrollWidth > optionsList.offsetWidth) {
optionsList.style.width = optionsList.scrollWidth + 25 + 'px';
optionsList.style.width = `${optionsList.scrollWidth + 25}px`;
}
},
change: () => {

File diff suppressed because one or more lines are too long

View File

@@ -7731,7 +7731,7 @@ declare namespace ej {
*/
enableRTL?: boolean;
/** The CSS class name to display the favicon in the dialog header. In order to display favicon, you need to set showHeader as true since the favicon will be displayed in the dialog
/** The CSS class name to display the favicon in the dialog header. In order to display favicon, you need to set "showHeader" as true since the favicon will be displayed in the dialog
* header.
*/
faviconCSS?: string;

View File

@@ -4,7 +4,6 @@
// All are TODOs
"comment-format": false,
"no-consecutive-blank-lines": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-padding": false,
"no-unnecessary-qualifier": false,

View File

@@ -3,6 +3,7 @@
"rules": {
// TODOs
"no-boolean-literal-compare": false,
"no-empty-interface": false
"no-empty-interface": false,
"no-void-expression": false
}
}

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/socketio/engine.io
// Definitions by: KentarouTakeda <https://github.com/KentarouTakeda>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />

4
types/event-emitter/all-off.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
import { Emitter } from "event-emitter";
declare function allOff(emitter: Emitter): void;
export = allOff;

View File

@@ -0,0 +1,35 @@
import { Emitter } from "event-emitter";
import ee = require("event-emitter");
import allOff = require("event-emitter/all-off");
import hasListeners = require("event-emitter/has-listeners");
import { EmitterPipe } from "event-emitter/pipe";
import pipe = require("event-emitter/pipe");
import unify = require("event-emitter/unify");
const obj = {};
const emitter1: Emitter = ee(obj);
const emitter2: Emitter = ee(obj);
function listener(param: string) {}
emitter1.on("test", listener);
emitter1.once("test", listener);
emitter1.off("test", listener);
emitter1.emit("test", "foo");
allOff(emitter1);
hasListeners(emitter1);
hasListeners(emitter1, "test");
const eePipe1: EmitterPipe = pipe(emitter1, emitter2);
const eePipe2: EmitterPipe = pipe(emitter1, emitter2, "foo");
eePipe1.close();
const unifiedEmitter: Emitter = unify(emitter1, emitter2);
unifiedEmitter.on("test", listener);
unifiedEmitter.once("test", listener);
unifiedEmitter.off("test", listener);
unifiedEmitter.emit("test", "foo");

View File

@@ -0,0 +1,4 @@
import { Emitter } from "event-emitter";
declare function hasListeners(emitter: Emitter, name?: string): boolean;
export = hasListeners;

20
types/event-emitter/index.d.ts vendored Normal file
View File

@@ -0,0 +1,20 @@
// Type definitions for event-emitter 0.3
// Project: https://github.com/medikoo/event-emitter#readme
// Definitions by: Karol Janyst <https://github.com/LKay>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace ee {
type EventListener = (...args: any[]) => void;
type EmitterMethod = (type: string, listener: EventListener) => void;
interface Emitter {
emit(type: string, ...args: any[]): void;
off: EmitterMethod;
on: EmitterMethod;
once: EmitterMethod;
}
}
declare function ee(obj: any): ee.Emitter;
export = ee;

10
types/event-emitter/pipe.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
import { Emitter } from "event-emitter";
declare namespace pipe {
interface EmitterPipe {
close(): void;
}
}
declare function pipe(source: Emitter, target: Emitter, emitMethodName?: string | symbol): pipe.EmitterPipe;
export = pipe;

View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"all-off.d.ts",
"has-listeners.d.ts",
"index.d.ts",
"pipe.d.ts",
"unify.d.ts",
"event-emitter-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

4
types/event-emitter/unify.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
import { Emitter } from "event-emitter";
declare function unify(emitter1: Emitter, emitter2: Emitter): Emitter;
export = unify;

View File

@@ -145,7 +145,8 @@ export function readFileSync(filename: string, options: OpenOptions | string): s
* OpenOptions: options
* @param callback
*/
export function writeFile(filename: string, data: any, options?: OpenOptions | string, callback?: (err: Error) => void): void;
export function writeFile(filename: string, data: any, callback?: (err: Error) => void): void;
export function writeFile(filename: string, data: any, options: OpenOptions | string, callback?: (err: Error) => void): void;
/**
* writeFileSync
* @param filename
@@ -164,7 +165,8 @@ export function writeFileSync(filename: string, data: any, option?: OpenOptions
* OpenOptions: options
* @param callback
*/
export function appendFile(filename: string, data: any, option?: OpenOptions | string, callback?: (err: Error) => void): void;
export function appendFile(filename: string, data: any, callback?: (err: Error) => void): void;
export function appendFile(filename: string, data: any, option: OpenOptions | string, callback?: (err: Error) => void): void;
/**
* appendFileSync
* @param filename

View File

@@ -47,13 +47,9 @@ let writeStream: stream.Writable;
let isDirectory: boolean;
fs.copy(src, dest, errorCallback);
fs.copy(src, dest, (src: string) => {
return false;
}, errorCallback);
fs.copy(src, dest, { filter: (src: string) => false }, errorCallback);
fs.copySync(src, dest);
fs.copySync(src, dest, (src: string) => {
return false;
});
fs.copySync(src, dest, { filter: (src: string) => false });
fs.createFile(file, errorCallback);
fs.createFileSync(file);

View File

@@ -43,7 +43,7 @@ fs.copy(src, dest, { overwrite: true }).then(() => {
// stub
});
fs.copy(src, dest, errorCallback);
fs.copy(src, dest, (src: string) => false, errorCallback);
fs.copy(src, dest, { filter: src => false }, errorCallback);
fs.copy(src, dest,
{
overwrite: true,
@@ -61,7 +61,7 @@ fs.copy(src, dest,
errorCallback
);
fs.copySync(src, dest);
fs.copySync(src, dest, (src: string) => false);
fs.copySync(src, dest, { filter: src => false });
fs.copySync(src, dest, { filter: /.*/ });
fs.copySync(src, dest,
{

View File

@@ -418,7 +418,7 @@ $('#calendar').fullCalendar({
$('#calendar').fullCalendar({
dayClick(date, jsEvent, view) {
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`);
alert('Current view: ' + view.name);
@@ -430,7 +430,7 @@ $('#calendar').fullCalendar({
$('#calendar').fullCalendar({
eventClick(calEvent, jsEvent, view) {
alert('Event: ' + calEvent.title);
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`);
alert('View: ' + view.name);
// change the border color just for fun
@@ -649,7 +649,7 @@ $('#my-draggable').draggable({
$('#calendar').fullCalendar({
droppable: true,
drop(date, allDay) {
alert("Dropped on " + date + " with allDay=" + allDay);
alert(`Dropped on ${date} with allDay=${allDay}`);
}
});

View File

@@ -421,7 +421,7 @@ $('#calendar').fullCalendar({
alert('Clicked on the slot: ' + date);
}
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`);
alert('Current view: ' + view.name);
@@ -433,7 +433,7 @@ $('#calendar').fullCalendar({
$('#calendar').fullCalendar({
eventClick(calEvent, jsEvent, view) {
alert('Event: ' + calEvent.title);
alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY);
alert(`Coordinates: ${jsEvent.pageX},${jsEvent.pageY}`);
alert('View: ' + view.name);
// change the border color just for fun
@@ -656,7 +656,7 @@ $('#my-draggable').draggable({
$('#calendar').fullCalendar({
droppable: true,
drop(date, allDay) {
alert("Dropped on " + date + " with allDay=" + allDay);
alert(`Dropped on ${date} with allDay=${allDay}`);
}
});

View File

@@ -334,7 +334,7 @@ declare namespace gapi.client.calendar {
start: {
date?: date;
dateTime?: datetime;
timeZone: string;
timeZone?: string;
};
// Optional Properties

View File

@@ -5,5 +5,5 @@ getStdin().then(str => {
});
getStdin.buffer().then(buffer => {
console.log("Length " + buffer.length + buffer.toString());
console.log(`Length ${buffer.length}${buffer.toString()}`);
});

View File

@@ -0,0 +1,7 @@
import * as gitRev from "git-rev";
gitRev.short((result) => {});
gitRev.long((result) => {});
gitRev.branch((result) => {});
gitRev.tag((result) => {});
gitRev.log((result) => {});

10
types/git-rev/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Type definitions for git-rev 0.2
// Project: https://github.com/tblobaum/git-rev
// Definitions by: Spicy Pixel <http://spicypixel.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export function short(callback: (short: string) => void): void;
export function long(callback: (long: string) => void): void;
export function branch(callback: (branch: string) => void): void;
export function tag(callback: (tag: string) => void): void;
export function log(callback: (log: string[][]) => void): void;

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"git-rev-tests.ts"
]
}

View File

@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"dt-header": false
}
}

16
types/go/index.d.ts vendored
View File

@@ -5452,7 +5452,7 @@ declare namespace go {
/**
* Copies properties from this model to the given model, which must be of the same class as this model.
* @param {Model} copy
* @param {Model} copy
*/
protected cloneProtected(copy: Model): void;
@@ -6629,7 +6629,7 @@ declare namespace go {
/**
* Copies properties from this layout to the given layout, which must be of the same class as this layout.
* @param {Layout} copy
* @param {Layout} copy
*/
protected cloneProtected(copy: Layout): void;
@@ -8872,12 +8872,6 @@ declare namespace go {
*/
any(pred: (x: T) => boolean): boolean;
/**
* Produce an Iterator that first iterates over the items of this Iterator and then iterates over the items of the given Iterator.
* @param {Iterable.<T>} it An Iterable
*/
concat<S>(it: Iterable<S>): Iterator<S | T>;
/**
* Call the given function on each item in the collection.
* @param {(x: T) => void} func
@@ -8895,12 +8889,6 @@ declare namespace go {
*/
first(): T;
/**
* Call the given function on each item in the collection and present the results in an iterator.
* @param {function(T)} func This function must not modify the collection.
*/
map<S>(func: (x: T) => S): Iterator<S>;
/**
* Call this method to advance the iterator to the next item in the collection.
*/

View File

@@ -22,7 +22,7 @@ declare namespace GoogleAppsScript {
deleteProperty(key: string): Properties;
getKeys(): String[];
getProperties(): Object;
getProperty(key: string): string;
getProperty(key: string): string | null;
setProperties(properties: Object): Properties;
setProperties(properties: Object, deleteAllOthers: boolean): Properties;
setProperty(key: string, value: string): Properties;
@@ -60,7 +60,7 @@ declare namespace GoogleAppsScript {
deleteProperty(key: string): ScriptProperties;
getKeys(): String[];
getProperties(): Object;
getProperty(key: string): string;
getProperty(key: string): string | null;
setProperties(properties: Object): ScriptProperties;
setProperties(properties: Object, deleteAllOthers: boolean): ScriptProperties;
setProperty(key: string, value: string): ScriptProperties;
@@ -77,7 +77,7 @@ declare namespace GoogleAppsScript {
deleteProperty(key: string): UserProperties;
getKeys(): String[];
getProperties(): Object;
getProperty(key: string): string;
getProperty(key: string): string | null;
setProperties(properties: Object): UserProperties;
setProperties(properties: Object, deleteAllOthers: boolean): UserProperties;
setProperty(key: string, value: string): UserProperties;

View File

@@ -294,7 +294,7 @@ export class TestFile {
* @param {DownloadOptions} options
* @return {Promise<[string]>}
*/
download(options?: DownloadOptions): Promise<[string]> {
download(options?: DownloadOptions): Promise<[Buffer]> {
return this.file.download(options);
}

Some files were not shown because too many files have changed in this diff Show More