From 5ce0dfb57be2b3ceaec695003bfd4aa5ab0f6981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81kos=20Luk=C3=A1cs?= Date: Tue, 23 Jun 2015 11:07:10 +0200 Subject: [PATCH 001/167] definitions for angular-gettext v2.1.0 https://angular-gettext.rocketeer.be/ --- angular-gettext/angular-gettext-tests.ts | 55 +++++++++++++++++++ angular-gettext/angular-gettext.d.ts | 68 ++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 angular-gettext/angular-gettext-tests.ts create mode 100644 angular-gettext/angular-gettext.d.ts diff --git a/angular-gettext/angular-gettext-tests.ts b/angular-gettext/angular-gettext-tests.ts new file mode 100644 index 000000000..5500d914e --- /dev/null +++ b/angular-gettext/angular-gettext-tests.ts @@ -0,0 +1,55 @@ +/// + +module angular_gettext_tests { + var gettextCatalog: angular_gettext.gettextCatalog; + + + // Configuring angular-gettext + // https://angular-gettext.rocketeer.be/dev-guide/configure/ + //Setting the language + gettextCatalog.setCurrentLanguage('nl'); + + //Highlighting untranslated strings + gettextCatalog.debug = true; + + + + // Marking strings in JavaScript code as translatable. + // https://angular-gettext.rocketeer.be/dev-guide/annotate-js/ + var gettext = angular_gettext.gettext; + var myString = gettext("Hello"); + + //Translating directly in JavaScript. + angular.module("myApp").controller("helloController", function (gettextCatalog) { + var translated: string = gettextCatalog.getString("Hello"); + }); + + angular.module("myApp").controller("helloController", function (gettextCatalog) { + var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds"); + }); + + var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" }); + + + // Setting strings manually + // https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ + + angular.module("myApp").run(function (gettextCatalog: angular_gettext.gettextCatalog) { + // Load the strings automatically during initialization. + gettextCatalog.setStrings("nl", { + "Hello": "Hallo", + "One boat": ["Een boot", "{{$count}} boats"] + }); + }); + + + // Lazy-loading languages + // https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ + angular.module("myApp").controller("helloController", function ($scope, gettextCatalog: angular_gettext.gettextCatalog) { + $scope.switchLanguage = function (lang: string) { + gettextCatalog.setCurrentLanguage(lang); + gettextCatalog.loadRemote("/languages/" + lang + ".json"); + }; + }); + +} \ No newline at end of file diff --git a/angular-gettext/angular-gettext.d.ts b/angular-gettext/angular-gettext.d.ts new file mode 100644 index 000000000..01e4b070e --- /dev/null +++ b/angular-gettext/angular-gettext.d.ts @@ -0,0 +1,68 @@ +// Type definitions for angular-gettext v2.1.0 +// Project: https://angular-gettext.rocketeer.be/ +// Definitions by: Ákos Lukács https://github.com/AkosLukacs +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular_gettext { + interface gettextCatalog { + + ////////////// + /// Fields /// + ////////////// + + /** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */ + debug: boolean; + /** (default: [MISSING]:): Custom prefix for untranslated strings. */ + debugPrefix: string; + /** (default: false): Whether or not to wrap all processed text with markers.Example output: [Welcome] */ + showTranslatedMarkers: boolean; + /** (default: [): Custom prefix to mark strings that have been run through angular-gettext. */ + translatedMarkerPrefix: string; + /** (default: ]): Custom suffix to mark strings that have been run through angular-gettext. */ + translatedMarkerSuffix: string; + /** An object of loaded translation strings.Shouldn't be used directly. */ + strings: {}; + /** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated */ + baseLanguage: string; + + + /////////////// + /// Methods /// + /////////////// + + /** Sets the current language and makes sure that all translations get updated correctly. */ + setCurrentLanguage(lang: string); + + /** Returns the current language. */ + getCurrentLanguage(): string; + + /** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ + @param language A language code. + @param strings A dictionary of strings. The format of this dictionary is: + - Keys: Singular English strings (as defined in the source files) + - Values: Either a single string for signular-only strings or an array of plural forms. */ + setStrings(language: string, strings: { [key: string]: string|string[] }); + + /** Get the correct pluralized (but untranslated) string for the value of n. */ + getStringForm(string: string, n: number): string; + + /** Translate a string with the given context. Uses Angular.JS interpolation, so something like this will do what you expect: + * var hello = gettextCatalog.getString("Hello {{name}}!", { name: "Ruben" }); + * // var hello will be "Hallo Ruben!" in Dutch. + * The context parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster. + */ + getString(string: string, context?: any): string; + + /** Translate a plural string with the given context. */ + getPlural(n: number, string: string, stringPlural: string, context?: any): string; + + /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ + loadRemote(url: string); + } + + /** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */ + function gettext(dummyString: string): string; +} + From 7a37cdbfbcb3576021f7e19385a93a17a3ed2ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81kos=20Luk=C3=A1cs?= Date: Tue, 23 Jun 2015 11:23:50 +0200 Subject: [PATCH 002/167] more type arguments + header format fix --- angular-gettext/angular-gettext-tests.ts | 13 +++++++------ angular-gettext/angular-gettext.d.ts | 12 +++++++----- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/angular-gettext/angular-gettext-tests.ts b/angular-gettext/angular-gettext-tests.ts index 5500d914e..706fb67fe 100644 --- a/angular-gettext/angular-gettext-tests.ts +++ b/angular-gettext/angular-gettext-tests.ts @@ -12,19 +12,18 @@ module angular_gettext_tests { //Highlighting untranslated strings gettextCatalog.debug = true; - - + // Marking strings in JavaScript code as translatable. // https://angular-gettext.rocketeer.be/dev-guide/annotate-js/ var gettext = angular_gettext.gettext; var myString = gettext("Hello"); //Translating directly in JavaScript. - angular.module("myApp").controller("helloController", function (gettextCatalog) { + angular.module("myApp").controller("helloController", function (gettextCatalog: angular_gettext.gettextCatalog) { var translated: string = gettextCatalog.getString("Hello"); }); - angular.module("myApp").controller("helloController", function (gettextCatalog) { + angular.module("myApp").controller("helloController", function (gettextCatalog: angular_gettext.gettextCatalog) { var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds"); }); @@ -43,13 +42,15 @@ module angular_gettext_tests { }); + interface helloControllerScope extends ng.IScope { + switchLanguage: (lang: string) => void; + } // Lazy-loading languages // https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ - angular.module("myApp").controller("helloController", function ($scope, gettextCatalog: angular_gettext.gettextCatalog) { + angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular_gettext.gettextCatalog) { $scope.switchLanguage = function (lang: string) { gettextCatalog.setCurrentLanguage(lang); gettextCatalog.loadRemote("/languages/" + lang + ".json"); }; }); - } \ No newline at end of file diff --git a/angular-gettext/angular-gettext.d.ts b/angular-gettext/angular-gettext.d.ts index 01e4b070e..d226801dc 100644 --- a/angular-gettext/angular-gettext.d.ts +++ b/angular-gettext/angular-gettext.d.ts @@ -1,6 +1,6 @@ // Type definitions for angular-gettext v2.1.0 // Project: https://angular-gettext.rocketeer.be/ -// Definitions by: Ákos Lukács https://github.com/AkosLukacs +// Definitions by: Ákos Lukács // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -24,7 +24,9 @@ declare module angular_gettext { translatedMarkerSuffix: string; /** An object of loaded translation strings.Shouldn't be used directly. */ strings: {}; - /** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated */ + /** The default language, in which you're application is written. This defaults to English and it's generally a bad idea to use anything else: if your language has different pluralization rules you'll end up with incorrect translations. Deprecated + * @deprecreated + */ baseLanguage: string; @@ -33,7 +35,7 @@ declare module angular_gettext { /////////////// /** Sets the current language and makes sure that all translations get updated correctly. */ - setCurrentLanguage(lang: string); + setCurrentLanguage(lang: string): void; /** Returns the current language. */ getCurrentLanguage(): string; @@ -43,7 +45,7 @@ declare module angular_gettext { @param strings A dictionary of strings. The format of this dictionary is: - Keys: Singular English strings (as defined in the source files) - Values: Either a single string for signular-only strings or an array of plural forms. */ - setStrings(language: string, strings: { [key: string]: string|string[] }); + setStrings(language: string, strings: { [key: string]: string|string[] }): void; /** Get the correct pluralized (but untranslated) string for the value of n. */ getStringForm(string: string, n: number): string; @@ -59,7 +61,7 @@ declare module angular_gettext { getPlural(n: number, string: string, stringPlural: string, context?: any): string; /** Load a set of translation strings from a given URL.This should be a JSON catalog generated with grunt-angular-gettext. More details https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ */ - loadRemote(url: string); + loadRemote(url: string): ng.IHttpPromise; } /** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */ From 15c8ddaa001be3234a56f246ca0e2e5edcbf772f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81kos=20Luk=C3=A1cs?= Date: Tue, 23 Jun 2015 16:32:40 +0200 Subject: [PATCH 003/167] rename module from angular_gettext to angular.gettext + some whitespace cleanup --- angular-gettext/angular-gettext-tests.ts | 31 ++++++++++++++---------- angular-gettext/angular-gettext.d.ts | 23 ++++++++++-------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/angular-gettext/angular-gettext-tests.ts b/angular-gettext/angular-gettext-tests.ts index 706fb67fe..9a10f1062 100644 --- a/angular-gettext/angular-gettext-tests.ts +++ b/angular-gettext/angular-gettext-tests.ts @@ -1,39 +1,44 @@ /// module angular_gettext_tests { - var gettextCatalog: angular_gettext.gettextCatalog; - + // Configuring angular-gettext // https://angular-gettext.rocketeer.be/dev-guide/configure/ //Setting the language - gettextCatalog.setCurrentLanguage('nl'); + angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) { + gettextCatalog.setCurrentLanguage('nl'); + }); //Highlighting untranslated strings - gettextCatalog.debug = true; + angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) { + gettextCatalog.debug = true; + }); // Marking strings in JavaScript code as translatable. - // https://angular-gettext.rocketeer.be/dev-guide/annotate-js/ - var gettext = angular_gettext.gettext; - var myString = gettext("Hello"); + // https://angular-gettext.rocketeer.be/dev-guide/annotate-js/ + angular.module("myApp").controller("helloController", function (gettext: angular.gettext.gettextFunction) { + var myString = gettext("Hello"); + }); //Translating directly in JavaScript. - angular.module("myApp").controller("helloController", function (gettextCatalog: angular_gettext.gettextCatalog) { + angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { var translated: string = gettextCatalog.getString("Hello"); }); - angular.module("myApp").controller("helloController", function (gettextCatalog: angular_gettext.gettextCatalog) { + angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds"); }); - var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" }); - + angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) { + var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" }); + }); // Setting strings manually // https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ - angular.module("myApp").run(function (gettextCatalog: angular_gettext.gettextCatalog) { + angular.module("myApp").run(function (gettextCatalog: angular.gettext.gettextCatalog) { // Load the strings automatically during initialization. gettextCatalog.setStrings("nl", { "Hello": "Hallo", @@ -47,7 +52,7 @@ module angular_gettext_tests { } // Lazy-loading languages // https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/ - angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular_gettext.gettextCatalog) { + angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular.gettext.gettextCatalog) { $scope.switchLanguage = function (lang: string) { gettextCatalog.setCurrentLanguage(lang); gettextCatalog.loadRemote("/languages/" + lang + ".json"); diff --git a/angular-gettext/angular-gettext.d.ts b/angular-gettext/angular-gettext.d.ts index d226801dc..1a88ef164 100644 --- a/angular-gettext/angular-gettext.d.ts +++ b/angular-gettext/angular-gettext.d.ts @@ -5,13 +5,13 @@ /// -declare module angular_gettext { +declare module angular.gettext { interface gettextCatalog { - + ////////////// /// Fields /// ////////////// - + /** (default: false): Whether or not to prefix untranslated strings with [MISSING]: or a custom prefix. */ debug: boolean; /** (default: [MISSING]:): Custom prefix for untranslated strings. */ @@ -33,7 +33,7 @@ declare module angular_gettext { /////////////// /// Methods /// /////////////// - + /** Sets the current language and makes sure that all translations get updated correctly. */ setCurrentLanguage(lang: string): void; @@ -41,10 +41,11 @@ declare module angular_gettext { getCurrentLanguage(): string; /** Processes an object of string definitions. More details https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/ - @param language A language code. - @param strings A dictionary of strings. The format of this dictionary is: - - Keys: Singular English strings (as defined in the source files) - - Values: Either a single string for signular-only strings or an array of plural forms. */ + * @param language A language code. + * @param strings A dictionary of strings. The format of this dictionary is: + * - Keys: Singular English strings (as defined in the source files) + * - Values: Either a single string for signular-only strings or an array of plural forms. + */ setStrings(language: string, strings: { [key: string]: string|string[] }): void; /** Get the correct pluralized (but untranslated) string for the value of n. */ @@ -56,7 +57,7 @@ declare module angular_gettext { * The context parameter is optional: pass null (or don't pass anything) if you're not using it: this skips interpolation and is a lot faster. */ getString(string: string, context?: any): string; - + /** Translate a plural string with the given context. */ getPlural(n: number, string: string, stringPlural: string, context?: any): string; @@ -65,6 +66,8 @@ declare module angular_gettext { } /** If you have text that should be translated in your JavaScript code, wrap it with a call to a function named gettext. This module provides an injectable function to do so */ - function gettext(dummyString: string): string; + interface gettextFunction { + (dummyString: string): string; + } } From be05c35168a93633b9b60ff32811545ced7bad49 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Sat, 11 Jul 2015 20:51:30 +0500 Subject: [PATCH 004/167] Missing options parameters for .map(), .filter(), .promisifyAll(), and .nodeify() --- bluebird/bluebird-tests.ts | 232 +++++++++++++++++++++++++++++++++++-- bluebird/bluebird.d.ts | 57 +++++---- 2 files changed, 260 insertions(+), 29 deletions(-) diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index 7770e7c9b..55ddf7697 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -1,4 +1,4 @@ -/// +/// // Tests by: Bart van der Schoor @@ -365,12 +365,12 @@ fooProm = fooProm.timeout(num, str); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - fooProm.nodeify(); -fooProm = fooProm.nodeify((err: any) => { +fooProm = fooProm.nodeify((err: any) => { }); +fooProm = fooProm.nodeify((err: any, foo?: Foo) => { }); -}); -fooProm = fooProm.nodeify((err: any, foo?: Foo) => { - -}); +fooProm.nodeify({ spread: true }); +fooProm = fooProm.nodeify((err: any) => { }, { spread: true }); +fooProm = fooProm.nodeify((err: any, foo?: Foo) => { }, { spread: true }); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -504,6 +504,17 @@ barArrProm = fooProm.map((item: Foo) => { return bar; }); +barArrProm = fooProm.map((item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = fooProm.map((item: Foo) => { + return bar; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - barProm = fooProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { @@ -522,6 +533,17 @@ fooArrProm = fooArrProm.filter((item: Foo) => { return bool; }); +fooArrProm = fooArrProm.filter((item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = fooArrProm.filter((item: Foo) => { + return bool; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -613,12 +635,41 @@ voidProm = Promise.delay(num); func = Promise.promisify(f); func = Promise.promisify(f, obj); -; obj = Promise.promisifyAll(obj); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +declare var util: any; + +function defaultFilter(name, func) { + return util.isIdentifier(name) && + name.charAt(0) !== "_" && + !util.isClass(func); +} + +function DOMPromisifier(originalMethod) { + // return a function + return function promisified() { + var args = [].slice.call(arguments); + // Needed so that the original method can be called with the correct receiver + var self = this; + // which returns a promise + return new Promise(function(resolve, reject) { + args.push(resolve, reject); + originalMethod.apply(self, args); + }); + }; +} + +obj = Promise.promisifyAll(obj, { + suffix: "", + filter: defaultFilter, + promisifier: DOMPromisifier +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + //TODO enable generator /* func = Promise.coroutine(f); @@ -704,6 +755,26 @@ barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: return barThen; }); +barArrProm = Promise.map(fooThenArrThen, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fooArrThen @@ -721,6 +792,27 @@ barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: num return barThen; }); +barArrProm = Promise.map(fooArrThen, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArrThen, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fooThenArr @@ -738,6 +830,27 @@ barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: num return barThen; }); +barArrProm = Promise.map(fooThenArr, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArr, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fooArr @@ -755,6 +868,27 @@ barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) return barThen; }); +barArrProm = Promise.map(fooArr, (item: Foo) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArr, (item: Foo) => { + return barThen; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}, { + concurrency: 1 +}); +barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // reduce() @@ -848,6 +982,27 @@ fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLeng return boolThen; }); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fooArrThen @@ -865,6 +1020,27 @@ fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: return boolThen; }); +fooArrProm = Promise.filter(fooArrThen, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fooThenArr @@ -882,6 +1058,27 @@ fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: return boolThen; }); +fooArrProm = Promise.filter(fooThenArr, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // fooArr @@ -899,4 +1096,25 @@ fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: numb return boolThen; }); +fooArrProm = Promise.filter(fooArr, (item: Foo) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArr, (item: Foo) => { + return boolThen; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bool; +}, { + concurrency: 1 +}); +fooArrProm = Promise.filter(fooArr, (item: Foo, index: number, arrayLength: number) => { + return boolThen; +}, { + concurrency: 1 +}); + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index cd21d77e9..a0ccd30ec 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -116,7 +116,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. */ - nodeify(callback: (err: any, value?: R) => void): Promise; + nodeify(callback: (err: any, value?: R) => void, options?: Promise.SpreadOption): Promise; nodeify(...sink: any[]): void; /** @@ -312,8 +312,8 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Same as calling `Promise.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ // TODO type inference from array-resolving promise? - map(mapper: (item: Q, index: number, arrayLength: number) => Promise.Thenable): Promise; - map(mapper: (item: Q, index: number, arrayLength: number) => U): Promise; + map(mapper: (item: Q, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; + map(mapper: (item: Q, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; /** * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. @@ -326,8 +326,8 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ // TODO type inference from array-resolving promise? - filter(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable): Promise; - filter(filterer: (item: U, index: number, arrayLength: number) => boolean): Promise; + filter(filterer: (item: U, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; + filter(filterer: (item: U, index: number, arrayLength: number) => boolean, options?: Promise.ConcurrencyOption): Promise; /** * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. @@ -416,7 +416,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? - static promisifyAll(target: Object): Object; + static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): Object; /** * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. @@ -542,20 +542,20 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * *The original array is not modified.* */ // promise of array with promises of value - static map(values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static map(values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; + static map(values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; // promise of array with values - static map(values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static map(values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; + static map(values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; // array with promises of value - static map(values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static map(values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; + static map(values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; // array with values - static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => U): Promise; + static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; + static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; /** * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. @@ -588,20 +588,20 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * *The original array is not modified. */ // promise of array with promises of value - static filter(values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static filter(values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; + static filter(values: Promise.Thenable[]>, filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; // promise of array with values - static filter(values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static filter(values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; + static filter(values: Promise.Thenable, filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; // array with promises of value - static filter(values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static filter(values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; + static filter(values: Promise.Thenable[], filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; // array with values - static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable): Promise; - static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean): Promise; + static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => Promise.Thenable, option?: Promise.ConcurrencyOption): Promise; + static filter(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean, option?: Promise.ConcurrencyOption): Promise; } declare module Promise { @@ -618,6 +618,19 @@ declare module Promise { export interface OperationalError extends Error { } + export interface ConcurrencyOption { + concurrency: number; + } + export interface SpreadOption { + spread: boolean; + } + export interface PromisifyAllOptions { + suffix?: string; + filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean; + // The promisifier gets a reference to the original method and should return a function which returns a promise + promisifier?: (originalMethod: Function) => () => Thenable ; + } + // Ideally, we'd define e.g. "export class RangeError extends Error {}", // but as Error is defined as an interface (not a class), TypeScript doesn't // allow extending Error, only implementing it. From a98c5955e885bbef667c2a3aaf35fcc3e913f5c8 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Sat, 11 Jul 2015 20:58:02 +0500 Subject: [PATCH 005/167] explicit typings in tests --- bluebird/bluebird-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index 55ddf7697..f338678c7 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -642,13 +642,13 @@ obj = Promise.promisifyAll(obj); declare var util: any; -function defaultFilter(name, func) { +function defaultFilter(name: string, func: Function) { return util.isIdentifier(name) && name.charAt(0) !== "_" && !util.isClass(func); } -function DOMPromisifier(originalMethod) { +function DOMPromisifier(originalMethod: Function) { // return a function return function promisified() { var args = [].slice.call(arguments); From 4d86cc24082d6703ecaee46ecc970bd0ac744236 Mon Sep 17 00:00:00 2001 From: Maciej Kowalski Date: Mon, 20 Jul 2015 15:49:54 +0200 Subject: [PATCH 006/167] bump rx to 2.5.3 --- rx/rx-lite.d.ts | 129 +++++++++++++++++++++++++----------- rx/rx.aggregates.d.ts | 10 +-- rx/rx.async-lite.d.ts | 6 +- rx/rx.async-tests.ts | 2 +- rx/rx.async.d.ts | 2 +- rx/rx.backpressure.d.ts | 2 +- rx/rx.binding-lite.d.ts | 9 +-- rx/rx.binding.d.ts | 2 +- rx/rx.coincidence-lite.d.ts | 18 ++--- rx/rx.coincidence.d.ts | 2 +- rx/rx.d.ts | 4 +- rx/rx.experimental.d.ts | 82 +++++++++++------------ rx/rx.joinpatterns.d.ts | 2 +- rx/rx.lite.d.ts | 2 +- rx/rx.testing.d.ts | 2 +- rx/rx.time-lite.d.ts | 10 +++ rx/rx.time.d.ts | 9 ++- rx/rx.virtualtime.d.ts | 2 +- 18 files changed, 177 insertions(+), 118 deletions(-) diff --git a/rx/rx-lite.d.ts b/rx/rx-lite.d.ts index 3ea8c6ed8..851545fb8 100644 --- a/rx/rx-lite.d.ts +++ b/rx/rx-lite.d.ts @@ -50,7 +50,6 @@ declare module Rx { export module helpers { function noop(): void; function notDefined(value: any): boolean; - function isScheduler(value: any): boolean; function identity(value: T): T; function defaultNow(): number; function defaultComparer(left: any, right: any): boolean; @@ -117,6 +116,7 @@ declare module Rx { export interface IScheduler { now(): number; + isScheduler(value: any): boolean; schedule(action: () => void): IDisposable; scheduleWithState(state: TState, action: (scheduler: IScheduler, state: TState) => IDisposable): IDisposable; @@ -241,6 +241,23 @@ declare module Rx { combineLatest(second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; combineLatest(souces: Observable[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; combineLatest(souces: IPromise[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; + withLatestFrom(second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; + withLatestFrom(second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; + withLatestFrom(second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; + withLatestFrom(souces: Observable[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; + withLatestFrom(souces: IPromise[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; concat(...sources: Observable[]): Observable; concat(...sources: IPromise[]): Observable; concat(sources: Observable[]): Observable; @@ -291,7 +308,7 @@ declare module Rx { do(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; doAction(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; // alias for do tap(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable; // alias for do - + doOnNext(onNext: (value: T) => void, thisArg?: any): Observable; doOnError(onError: (exception: any) => void, thisArg?: any): Observable; doOnCompleted(onCompleted: () => void, thisArg?: any): Observable; @@ -305,7 +322,7 @@ declare module Rx { materialize(): Observable>; repeat(repeatCount?: number): Observable; retry(retryCount?: number): Observable; - scan(seed: TAcc, accumulator: (acc: TAcc, value: T) => TAcc): Observable; + scan(accumulator: (acc: TAcc, value: T, seed: TAcc) => TAcc): Observable; scan(accumulator: (acc: T, value: T) => T): Observable; skipLast(count: number): Observable; startWith(...values: T[]): Observable; @@ -322,12 +339,34 @@ declare module Rx { selectMany(selector: (value: T) => IPromise): Observable; selectMany(other: Observable): Observable; selectMany(other: IPromise): Observable; + selectMany(selector: (value: T) => TResult[]): Observable; // alias for selectMany flatMap(selector: (value: T) => Observable, resultSelector: (item: T, other: TOther) => TResult): Observable; // alias for selectMany flatMap(selector: (value: T) => IPromise, resultSelector: (item: T, other: TOther) => TResult): Observable; // alias for selectMany flatMap(selector: (value: T) => Observable): Observable; // alias for selectMany flatMap(selector: (value: T) => IPromise): Observable; // alias for selectMany flatMap(other: Observable): Observable; // alias for selectMany flatMap(other: IPromise): Observable; // alias for selectMany + flatMap(selector: (value: T) => TResult[]): Observable; // alias for selectMany + + /** + * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. + * @param {Function} onError A transform function to apply when an error occurs in the source sequence. + * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. + * @param {Any} [thisArg] An optional "this" to use to invoke each transform. + * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. + */ + selectManyObserver(onNext: (value: T, index: number) => Observable, onError: (exception: any) => Observable, onCompleted: () => Observable, thisArg?: any): Observable; + + /** + * Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. + * @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element. + * @param {Function} onError A transform function to apply when an error occurs in the source sequence. + * @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached. + * @param {Any} [thisArg] An optional "this" to use to invoke each transform. + * @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence. + */ + flatMapObserver(onNext: (value: T, index: number) => Observable, onError: (exception: any) => Observable, onCompleted: () => Observable, thisArg?: any): Observable; selectConcat(selector: (value: T, index: number) => Observable, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; selectConcat(selector: (value: T, index: number) => IPromise, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; @@ -336,30 +375,30 @@ declare module Rx { selectConcat(sequence: Observable): Observable; /** - * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then + * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param [thisArg] Object to use as this when executing callback. - * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences + * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ selectSwitch(selector: (value: T, index: number, source: Observable) => Observable, thisArg?: any): Observable; /** - * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then + * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param [thisArg] Object to use as this when executing callback. - * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences + * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ flatMapLatest(selector: (value: T, index: number, source: Observable) => Observable, thisArg?: any): Observable; // alias for selectSwitch /** - * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then + * Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then * transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. * @param [thisArg] Object to use as this when executing callback. * @since 2.2.28 - * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences + * @returns An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences * and that at any point in time produces the elements of the most recent inner observable sequence that has been received. */ switchMap(selector: (value: T, index: number, source: Observable) => TResult, thisArg?: any): Observable; // alias for selectSwitch @@ -383,7 +422,7 @@ declare module Rx { * Converts an existing observable sequence to an ES6 Compatible Promise * @example * var promise = Rx.Observable.return(42).toPromise(RSVP.Promise); - * + * * // With config * Rx.config.Promise = RSVP.Promise; * var promise = Rx.Observable.return(42).toPromise(); @@ -470,36 +509,12 @@ declare module Rx { fromArray(array: T[], scheduler?: IScheduler): Observable; fromArray(array: { length: number;[index: number]: T; }, scheduler?: IScheduler): Observable; - /** - * Converts an iterable into an Observable sequence - * - * @example - * var res = Rx.Observable.fromIterable(new Map()); - * var res = Rx.Observable.fromIterable(function* () { yield 42; }); - * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); - * @param generator Generator to convert from. - * @param [scheduler] Scheduler to run the enumeration of the input sequence on. - * @returns The observable sequence whose elements are pulled from the given generator sequence. - */ - fromIterable(generator: () => { next(): { done: boolean; value?: T; }; }, scheduler?: IScheduler): Observable; - - /** - * Converts an iterable into an Observable sequence - * - * @example - * var res = Rx.Observable.fromIterable(new Map()); - * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); - * @param iterable Iterable to convert from. - * @param [scheduler] Scheduler to run the enumeration of the input sequence on. - * @returns The observable sequence whose elements are pulled from the given generator sequence. - */ - fromIterable(iterable: {}, scheduler?: IScheduler): Observable; // todo: can't describe ES6 Iterable via TypeScript type system generate(initialState: TState, condition: (state: TState) => boolean, iterate: (state: TState) => TState, resultSelector: (state: TState) => TResult, scheduler?: IScheduler): Observable; never(): Observable; /** * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. - * + * * @example * var res = Rx.Observable.of(1, 2, 3); * @since 2.2.28 @@ -508,7 +523,7 @@ declare module Rx { of(...values: T[]): Observable; /** - * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. + * This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments. * @example * var res = Rx.Observable.ofWithScheduler(Rx.Scheduler.timeout, 1, 2, 3); * @since 2.2.28 @@ -576,6 +591,38 @@ declare module Rx { combineLatest(souces: Observable[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; combineLatest(souces: IPromise[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; + withLatestFrom(first: IPromise, second: Observable, resultSelector: (v1: T, v2: T2) => TResult): Observable; + withLatestFrom(first: Observable, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; + withLatestFrom(first: IPromise, second: IPromise, resultSelector: (v1: T, v2: T2) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: Observable, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: Observable, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: IPromise, second: Observable, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: IPromise, second: Observable, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: IPromise, second: IPromise, third: Observable, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: IPromise, second: IPromise, third: IPromise, resultSelector: (v1: T, v2: T2, v3: T3) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: Observable, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: Observable, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: Observable, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: Observable, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: IPromise, third: Observable, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: IPromise, third: Observable, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: IPromise, third: IPromise, fourth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: IPromise, second: IPromise, third: IPromise, fourth: IPromise, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4) => TResult): Observable; + withLatestFrom(first: Observable, second: Observable, third: Observable, fourth: Observable, fifth: Observable, resultSelector: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => TResult): Observable; + withLatestFrom(souces: Observable[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; + withLatestFrom(souces: IPromise[], resultSelector: (...otherValues: TOther[]) => TResult): Observable; + concat(...sources: Observable[]): Observable; concat(...sources: IPromise[]): Observable; concat(sources: Observable[]): Observable; @@ -617,6 +664,8 @@ declare module Rx { * @returns An Observable sequence which wraps the existing promise success and failure. */ fromPromise(promise: IPromise): Observable; + + prototype: any; } export var Observable: ObservableStatic; @@ -625,11 +674,11 @@ declare module Rx { hasObservers(): boolean; } - export interface Subject extends ISubject { - } + export interface Subject extends ISubject { + } - interface SubjectStatic { - new (): Subject; + interface SubjectStatic { + new (): Subject; create(observer?: Observer, observable?: Observable): ISubject; } diff --git a/rx/rx.aggregates.d.ts b/rx/rx.aggregates.d.ts index 001d1b993..313cb5591 100644 --- a/rx/rx.aggregates.d.ts +++ b/rx/rx.aggregates.d.ts @@ -40,17 +40,9 @@ declare module Rx { sequenceEqual(second: T[]): Observable; elementAt(index: number): Observable; - elementAtOrDefault(index: number, defaultValue?: T): Observable; - single(predicate?: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; - singleOrDefault(predicate?: (value: T, index: number, source: Observable) => boolean, defaultValue?: T, thisArg?: any): Observable; - first(predicate?: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; - firstOrDefault(predicate?: (value: T, index: number, source: Observable) => boolean, defaultValue?: T, thisArg?: any): Observable; - last(predicate?: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; - lastOrDefault(predicate?: (value: T, index: number, source: Observable) => boolean, defaultValue?: T, thisArg?: any): Observable; - find(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; findIndex(predicate: (value: T, index: number, source: Observable) => boolean, thisArg?: any): Observable; } @@ -58,4 +50,4 @@ declare module Rx { declare module "rx.aggregates" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.async-lite.d.ts b/rx/rx.async-lite.d.ts index 94eb39800..8a725332f 100644 --- a/rx/rx.async-lite.d.ts +++ b/rx/rx.async-lite.d.ts @@ -65,7 +65,9 @@ declare module Rx { (func: Function, context?: any): (...args: any[]) => Observable; }; - fromEvent(element: any, eventName: string, selector?: (arguments: any[]) => T): Observable; - fromEventPattern(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable; + fromEvent(element: NodeList, eventName: string, selector?: (arguments: any[]) => T): Observable; + fromEvent(element: Node, eventName: string, selector?: (arguments: any[]) => T): Observable; + fromEvent(element: {on: (name: string, cb: (e: any) => any) => void; off: (name: string, cb: (e: any) => any) => void}, eventName: string, selector?: (arguments: any[]) => T): Observable; + fromEventPattern(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable; } } diff --git a/rx/rx.async-tests.ts b/rx/rx.async-tests.ts index 4f8c102c4..6fe10526c 100644 --- a/rx/rx.async-tests.ts +++ b/rx/rx.async-tests.ts @@ -81,4 +81,4 @@ module Rx.Tests.Async { function startAsync() { var o: Rx.Observable = Rx.Observable.startAsync(() => >null); } -} \ No newline at end of file +} diff --git a/rx/rx.async.d.ts b/rx/rx.async.d.ts index 783f31d52..f1af9a600 100644 --- a/rx/rx.async.d.ts +++ b/rx/rx.async.d.ts @@ -40,4 +40,4 @@ declare module Rx { declare module "rx.async" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.backpressure.d.ts b/rx/rx.backpressure.d.ts index 18ab4ddd9..549cd870a 100644 --- a/rx/rx.backpressure.d.ts +++ b/rx/rx.backpressure.d.ts @@ -8,4 +8,4 @@ declare module "rx.backpressure" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.binding-lite.d.ts b/rx/rx.binding-lite.d.ts index f896e260d..86db8922c 100644 --- a/rx/rx.binding-lite.d.ts +++ b/rx/rx.binding-lite.d.ts @@ -7,6 +7,7 @@ declare module Rx { export interface BehaviorSubject extends Subject { + getValue(): T; } interface BehaviorSubjectStatic { @@ -43,10 +44,10 @@ declare module Rx { /** * Returns an observable sequence that shares a single subscription to the underlying sequence. * This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. - * + * * @example * var res = source.share(); - * + * * @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ share(): Observable; @@ -57,10 +58,10 @@ declare module Rx { /** * Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue. * This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed. - * + * * @example * var res = source.shareValue(42); - * + * * @param initialValue Initial value received by observers upon subscription. * @returns An observable sequence that contains the elements of a sequence produced by multicasting the source sequence. */ diff --git a/rx/rx.binding.d.ts b/rx/rx.binding.d.ts index b93411a52..2bd4c5b01 100644 --- a/rx/rx.binding.d.ts +++ b/rx/rx.binding.d.ts @@ -8,4 +8,4 @@ declare module "rx.binding" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.coincidence-lite.d.ts b/rx/rx.coincidence-lite.d.ts index 801e42168..ca1cc7347 100644 --- a/rx/rx.coincidence-lite.d.ts +++ b/rx/rx.coincidence-lite.d.ts @@ -9,24 +9,24 @@ declare module Rx { interface Observable { /** - * Returns a new observable that triggers on the second and subsequent triggerings of the input observable. - * The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair. + * Returns a new observable that triggers on the second and subsequent triggerings of the input observable. + * The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair. * The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs. * @returns An observable that triggers on successive pairs of observations from the input observable as an array. */ pairwise(): Observable; - /** + /** * Returns two observables which partition the observations of the source by the given function. - * The first will trigger observations for those values for which the predicate returns true. - * The second will trigger observations for those values where the predicate returns false. - * The predicate is executed once for each subscribed observer. - * Both also propagate all error observations arising from the source and each completes + * The first will trigger observations for those values for which the predicate returns true. + * The second will trigger observations for those values where the predicate returns false. + * The predicate is executed once for each subscribed observer. + * Both also propagate all error observations arising from the source and each completes * when the source completes. - * @param predicate + * @param predicate * The function to determine which output Observable will trigger a particular observation. * @returns - * An array of observables. The first triggers when the predicate returns true, + * An array of observables. The first triggers when the predicate returns true, * and the second triggers when the predicate returns false. */ partition(predicate: (value: T, index: number, source: Observable) => boolean, thisArg: any): Observable[]; diff --git a/rx/rx.coincidence.d.ts b/rx/rx.coincidence.d.ts index 87fa6a55b..d06166224 100644 --- a/rx/rx.coincidence.d.ts +++ b/rx/rx.coincidence.d.ts @@ -33,4 +33,4 @@ declare module Rx { declare module "rx.coincidence" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.d.ts b/rx/rx.d.ts index f1dc527d7..9b806119e 100644 --- a/rx/rx.d.ts +++ b/rx/rx.d.ts @@ -1,4 +1,4 @@ -// Type definitions for RxJS v2.2.28 +// Type definitions for RxJS v2.5.3 // Project: http://rx.codeplex.com/ // Definitions by: gsino , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -39,7 +39,7 @@ declare module Rx { distinct(skipParameter: boolean, valueSerializer: (value: T) => string): Observable; distinct(keySelector?: (value: T) => TKey, keySerializer?: (key: TKey) => string): Observable; groupBy(keySelector: (value: T) => TKey, skipElementSelector?: boolean, keySerializer?: (key: TKey) => string): Observable>; - groupBy(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable>; + groupBy(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, keySerializer?: (key: TKey) => string): Observable>; groupByUntil(keySelector: (value: T) => TKey, skipElementSelector: boolean, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; groupByUntil(keySelector: (value: T) => TKey, elementSelector: (value: T) => TElement, durationSelector: (group: GroupedObservable) => Observable, keySerializer?: (key: TKey) => string): Observable>; } diff --git a/rx/rx.experimental.d.ts b/rx/rx.experimental.d.ts index 60aec86e1..e80ca0329 100644 --- a/rx/rx.experimental.d.ts +++ b/rx/rx.experimental.d.ts @@ -29,13 +29,13 @@ declare module Rx { /** * Repeats source as long as condition holds emulating a do while loop. * @param condition The condition which determines if the source will be repeated. - * @returns An observable sequence which is repeated as long as the condition holds. + * @returns An observable sequence which is repeated as long as the condition holds. */ doWhile(condition: () => boolean): Observable; /** * Expands an observable sequence by recursively invoking selector. - * + * * @param selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again. * @param [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler. * @returns An observable sequence containing all the elements produced by the recursive expansion. @@ -64,7 +64,7 @@ declare module Rx { interface ObservableStatic { /** * Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers (sources: T[], resultSelector: (item: T) => Observable): Observable; @@ -132,7 +132,7 @@ declare module Rx { * There is an alias for this method called 'forIn' for browsers (sources: T[], resultSelector: (item: T) => Observable): Observable; @@ -141,7 +141,7 @@ declare module Rx { * There is an alias for this method called 'whileDo' for browsers (condition: () => boolean, source: Observable): Observable; while(condition: () => boolean, source: IPromise): Observable; @@ -151,7 +151,7 @@ declare module Rx { * There is an alias for this method called 'whileDo' for browsers (condition: () => boolean, source: Observable): Observable; whileDo(condition: () => boolean, source: IPromise): Observable; @@ -159,14 +159,14 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => string, sources: { [key: string]: Observable; }, elseSource: Observable): Observable; case(selector: () => string, sources: { [key: string]: IPromise; }, elseSource: Observable): Observable; @@ -176,16 +176,16 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => string, sources: { [key: string]: Observable; }, scheduler?: IScheduler): Observable; case(selector: () => string, sources: { [key: string]: IPromise; }, scheduler?: IScheduler): Observable; @@ -193,14 +193,14 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => number, sources: { [key: number]: Observable; }, elseSource: Observable): Observable; case(selector: () => number, sources: { [key: number]: IPromise; }, elseSource: Observable): Observable; @@ -210,16 +210,16 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => number, sources: { [key: number]: Observable; }, scheduler?: IScheduler): Observable; case(selector: () => number, sources: { [key: number]: IPromise; }, scheduler?: IScheduler): Observable; @@ -227,14 +227,14 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => string, sources: { [key: string]: Observable; }, elseSource: Observable): Observable; switchCase(selector: () => string, sources: { [key: string]: IPromise; }, elseSource: Observable): Observable; @@ -244,16 +244,16 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => string, sources: { [key: string]: Observable; }, scheduler?: IScheduler): Observable; switchCase(selector: () => string, sources: { [key: string]: IPromise; }, scheduler?: IScheduler): Observable; @@ -261,14 +261,14 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => number, sources: { [key: number]: Observable; }, elseSource: Observable): Observable; switchCase(selector: () => number, sources: { [key: number]: IPromise; }, elseSource: Observable): Observable; @@ -278,23 +278,23 @@ declare module Rx { /** * Uses selector to determine which source in sources to use. * There is an alias 'switchCase' for browsers (selector: () => number, sources: { [key: number]: Observable; }, scheduler?: IScheduler): Observable; switchCase(selector: () => number, sources: { [key: number]: IPromise; }, scheduler?: IScheduler): Observable; /** * Runs all observable sequences in parallel and collect their last elements. - * + * * @example * res = Rx.Observable.forkJoin([obs1, obs2]); * @param sources Array of source sequences or promises. @@ -305,7 +305,7 @@ declare module Rx { /** * Runs all observable sequences in parallel and collect their last elements. - * + * * @example * res = Rx.Observable.forkJoin(obs1, obs2, ...); * @param args Source sequences or promises. @@ -318,4 +318,4 @@ declare module Rx { declare module "rx.experimental" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.joinpatterns.d.ts b/rx/rx.joinpatterns.d.ts index ce251a2db..fc20f8254 100644 --- a/rx/rx.joinpatterns.d.ts +++ b/rx/rx.joinpatterns.d.ts @@ -57,4 +57,4 @@ declare module Rx { declare module "rx.joinpatterns" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.lite.d.ts b/rx/rx.lite.d.ts index f6785a1a7..66ec67849 100644 --- a/rx/rx.lite.d.ts +++ b/rx/rx.lite.d.ts @@ -12,4 +12,4 @@ declare module "rx.lite" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.testing.d.ts b/rx/rx.testing.d.ts index 466243784..58b074f75 100644 --- a/rx/rx.testing.d.ts +++ b/rx/rx.testing.d.ts @@ -61,4 +61,4 @@ declare module Rx { declare module "rx.testing" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.time-lite.d.ts b/rx/rx.time-lite.d.ts index 3642377f8..f7a902685 100644 --- a/rx/rx.time-lite.d.ts +++ b/rx/rx.time-lite.d.ts @@ -19,11 +19,21 @@ declare module Rx { export interface Observable { delay(dueTime: Date, scheduler?: IScheduler): Observable; delay(dueTime: number, scheduler?: IScheduler): Observable; + + debounce(dueTime: number, scheduler?: IScheduler): Observable; + throttleWithTimeout(dueTime: number, scheduler?: IScheduler): Observable; + /** + * @deprecated use #debounce or #throttleWithTimeout instead. + */ throttle(dueTime: number, scheduler?: IScheduler): Observable; + timeInterval(scheduler?: IScheduler): Observable>; + timestamp(scheduler?: IScheduler): Observable>; + sample(interval: number, scheduler?: IScheduler): Observable; sample(sampler: Observable, scheduler?: IScheduler): Observable; + timeout(dueTime: Date, other?: Observable, scheduler?: IScheduler): Observable; timeout(dueTime: number, other?: Observable, scheduler?: IScheduler): Observable; } diff --git a/rx/rx.time.d.ts b/rx/rx.time.d.ts index 3da66b95c..2e3ea0a09 100644 --- a/rx/rx.time.d.ts +++ b/rx/rx.time.d.ts @@ -13,7 +13,12 @@ declare module Rx { delayWithSelector(subscriptionDelay: number, delayDurationSelector: (item: T) => number): Observable; timeoutWithSelector(firstTimeout: Observable, timeoutdurationSelector?: (item: T) => Observable, other?: Observable): Observable; - throttleWithSelector(throttleDurationSelector: (item: T) => Observable): Observable; + + debounceWithSelector(debounceDurationSelector: (item: T) => Observable): Observable; + /** + * @deprecated use #debounceWithSelector instead. + */ + throttleWithSelector(debounceDurationSelector: (item: T) => Observable): Observable; skipLastWithTime(duration: number, scheduler?: IScheduler): Observable; takeLastWithTime(duration: number, timerScheduler?: IScheduler, loopScheduler?: IScheduler): Observable; @@ -58,4 +63,4 @@ declare module Rx { declare module "rx.time" { export = Rx; -} \ No newline at end of file +} diff --git a/rx/rx.virtualtime.d.ts b/rx/rx.virtualtime.d.ts index 25e894074..bac31a0d3 100644 --- a/rx/rx.virtualtime.d.ts +++ b/rx/rx.virtualtime.d.ts @@ -38,4 +38,4 @@ declare module Rx { declare module "rx.virtualtime" { export = Rx; -} \ No newline at end of file +} From 2daf450b8f86f09f6b0de1b5f86fce3cf185c687 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Aug 2015 14:21:19 +0200 Subject: [PATCH 007/167] updated enabled as per angular changes (after 1.3.14 > 1.4.0) --- angularjs/angular-animate.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index 1ecc3d0d7..35fe10ca9 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -30,11 +30,11 @@ declare module angular.animate { /** * Globally enables / disables animations. * - * @param value If provided then set the animation on or off. * @param element If provided then the element will be used to represent the enable/disable operation. + * @param value If provided then set the animation on or off. * @returns current animation state */ - enabled(value?: boolean, element?: JQuery): boolean; + enabled(element?: JQuery, value?: boolean): boolean; /** * Performs an inline animation on the element. From a22c78d619f18548081e69ce68b950dc6265a74a Mon Sep 17 00:00:00 2001 From: Alexander Horn Date: Mon, 24 Aug 2015 21:00:14 +0200 Subject: [PATCH 008/167] mysql: Added .format() overload Added the .format() overload thats accepts an object for the values parameter --- mysql/mysql-tests.ts | 4 ++++ mysql/mysql.d.ts | 3 +++ 2 files changed, 7 insertions(+) diff --git a/mysql/mysql-tests.ts b/mysql/mysql-tests.ts index f671a6372..97df14dbf 100644 --- a/mysql/mysql-tests.ts +++ b/mysql/mysql-tests.ts @@ -109,6 +109,10 @@ var sql = "SELECT * FROM ?? WHERE ?? = ?"; var inserts = ['users', 'id', userId]; sql = mysql.format(sql, inserts); +var sql = "INSERT INTO posts SET ?"; +var post = { id: 1, title: 'Hello MySQL' }; +sql = mysql.format(sql, post); + connection.config.queryFormat = function (query, values) { if (!values) return query; return query.replace(/\:(\w+)/g, function (txt: string, key: string) { diff --git a/mysql/mysql.d.ts b/mysql/mysql.d.ts index 9b6ed7998..715c799a2 100644 --- a/mysql/mysql.d.ts +++ b/mysql/mysql.d.ts @@ -15,6 +15,7 @@ declare module "mysql" { function escape(value: any): string; function format(sql: string): string; function format(sql: string, values: Array): string; + function format(sql: string, values: any): string; interface IMySql { createConnection(connectionUri: string): IConnection; @@ -24,6 +25,7 @@ declare module "mysql" { escape(value: any): string; format(sql: string): string; format(sql: string, values: Array): string; + format(sql: string, values: any): string; } interface IConnectionStatic { @@ -69,6 +71,7 @@ declare module "mysql" { format(sql: string): string; format(sql: string, values: Array): string; + format(sql: string, values: any): string; on(ev: string, callback: (...args: any[]) => void): IConnection; on(ev: 'error', callback: (err: IError) => void): IConnection; From fbdc1b91125a87e62be3803f58aabb176cc2fd50 Mon Sep 17 00:00:00 2001 From: tkQubo Date: Fri, 21 Aug 2015 12:46:12 +0900 Subject: [PATCH 009/167] Move IGulpPlugin into gulp namespace, Gulp extends orchestrator, and gulp#watch method returns NodeJS.EventEmitter --- gulp-protractor/gulp-protractor.d.ts | 2 + gulp-tsd/gulp-tsd-tests.ts | 2 +- gulp-tsd/gulp-tsd.d.ts | 1 + gulp/gulp-tests.ts | 7 +- gulp/gulp.d.ts | 541 ++++++++++++++------------- run-sequence/run-sequence-tests.ts | 2 +- run-sequence/run-sequence.d.ts | 1 + 7 files changed, 291 insertions(+), 265 deletions(-) diff --git a/gulp-protractor/gulp-protractor.d.ts b/gulp-protractor/gulp-protractor.d.ts index d0317e2e2..4ac814780 100644 --- a/gulp-protractor/gulp-protractor.d.ts +++ b/gulp-protractor/gulp-protractor.d.ts @@ -7,6 +7,8 @@ /// declare module 'gulp-protractor' { + import gulp = require('gulp'); + interface IOptions { configFile?: string; args?: Array; diff --git a/gulp-tsd/gulp-tsd-tests.ts b/gulp-tsd/gulp-tsd-tests.ts index 9475ace65..a7c20519c 100644 --- a/gulp-tsd/gulp-tsd-tests.ts +++ b/gulp-tsd/gulp-tsd-tests.ts @@ -9,7 +9,7 @@ gulp.task("tsd", () => { .pipe(tsd()); }); -gulp.task("tsd:options", callback => { +gulp.task("tsd:options", (callback: any) => { tsd({ command: "reinstall", config: "tsd.json" diff --git a/gulp-tsd/gulp-tsd.d.ts b/gulp-tsd/gulp-tsd.d.ts index 68a4c6728..20d279329 100644 --- a/gulp-tsd/gulp-tsd.d.ts +++ b/gulp-tsd/gulp-tsd.d.ts @@ -7,6 +7,7 @@ /// declare module "gulp-tsd" { + import gulp = require('gulp'); interface IOptions { command?: string; diff --git a/gulp/gulp-tests.ts b/gulp/gulp-tests.ts index 07a92fc91..2a69d40ca 100644 --- a/gulp/gulp-tests.ts +++ b/gulp/gulp-tests.ts @@ -4,8 +4,8 @@ import gulp = require("gulp"); import browserSync = require("browser-sync"); -var typescript: IGulpPlugin = null; // this would be the TypeScript compiler -var jasmine: IGulpPlugin = null; // this would be the jasmine test runner +var typescript: gulp.IGulpPlugin = null; // this would be the TypeScript compiler +var jasmine: gulp.IGulpPlugin = null; // this would be the jasmine test runner gulp.task('compile', function() { @@ -31,6 +31,7 @@ gulp.task('test', ['compile', 'compile2'], function() gulp.task('default', ['compile', 'test']); + var opts = {}; gulp.watch('*.html', 'compile'); @@ -66,3 +67,5 @@ gulp.task('serve', ['compile'], () => { var browser = browserSync.create(); gulp.watch(['*.html', '*.ts'], ['compile', browser.reload]); }); + +gulp.start('test', 'compile'); diff --git a/gulp/gulp.d.ts b/gulp/gulp.d.ts index 13c12a811..abb8978d1 100644 --- a/gulp/gulp.d.ts +++ b/gulp/gulp.d.ts @@ -4,268 +4,287 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// - -declare module gulp { - - /** - * Options to pass to node-glob through glob-stream. - * Specifies two options in addition to those used by node-glob: - * https://github.com/isaacs/node-glob#options - */ - interface ISrcOptions { - /** - * Setting this to false will return file.contents as null - * and not read the file at all. - * Default: true. - */ - read?: boolean; - - /** - * Setting this to false will return file.contents as a stream and not buffer files. - * This is useful when working with large files. - * Note: Plugins might not implement support for streams. - * Default: true. - */ - buffer?: boolean; - - /** - * The base path of a glob. - * - * Default is everything before a glob starts. - */ - base?: string; - - /** - * The current working directory in which to search. - * Defaults to process.cwd(). - */ - cwd?: string; - - /** - * The place where patterns starting with / will be mounted onto. - * Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.) - */ - root?: string; - - /** - * Include .dot files in normal matches and globstar matches. - * Note that an explicit dot in a portion of the pattern will always match dot files. - */ - dot?: boolean; - - /** - * By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid - * filesystem path is returned. Set this flag to disable that behavior. - */ - nomount?: boolean; - - /** - * Add a / character to directory matches. Note that this requires additional stat calls. - */ - mark?: boolean; - - /** - * Don't sort the results. - */ - nosort?: boolean; - - /** - * Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless - * readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one - * level sooner in the case of cyclical symbolic links. - */ - stat?: boolean; - - /** - * When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr. - * Set the silent option to true to suppress these warnings. - */ - silent?: boolean; - - /** - * When an unusual error is encountered when attempting to read a directory, the process will just continue on in - * search of other matches. Set the strict option to raise an error in these cases. - */ - strict?: boolean; - - /** - * See cache property above. Pass in a previously generated cache object to save some fs calls. - */ - cache?: boolean; - - /** - * A cache of results of filesystem information, to prevent unnecessary stat calls. - * While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the - * options object of another, if you know that the filesystem will not change between calls. - */ - statCache?: boolean; - - /** - * Perform a synchronous glob search. - */ - sync?: boolean; - - /** - * In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set. - * By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior. - */ - nounique?: boolean; - - /** - * Set to never return an empty set, instead returning a set containing the pattern itself. - * This is the default in glob(3). - */ - nonull?: boolean; - - /** - * Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning - * results that are case-insensitively matched anyway, since readdir and stat will not raise an error. - */ - nocase?: boolean; - - /** - * Set to enable debug logging in minimatch and glob. - */ - debug?: boolean; - - /** - * Set to enable debug logging in glob, but not minimatch. - */ - globDebug?: boolean; - } - - interface IDestOptions { - /** - * The output folder. Only has an effect if provided output folder is relative. - * Default: process.cwd() - */ - cwd?: string; - - /** - * Octal permission string specifying mode for any folders that need to be created for output folder. - * Default: 0777. - */ - mode?: string; - } - - /** - * Options that are passed to gaze. - * https://github.com/shama/gaze - */ - interface IWatchOptions { - /** Interval to pass to fs.watchFile. */ - interval?: number; - /** Delay for events called in succession for the same file/event. */ - debounceDelay?: number; - /** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */ - mode?: string; - /** The current working directory to base file patterns from. Default is process.cwd().. */ - cwd?: string; - } - - interface IWatchEvent { - /** The type of change that occurred, either added, changed or deleted. */ - type: string; - /** The path to the file that triggered the event. */ - path: string; - } - - /** - * Callback to be called on each watched file change. - */ - interface IWatchCallback { - (event:IWatchEvent): void; - } - - interface ITaskCallback { - /** - * Defines a task. - * Tasks may be made asynchronous if they are passing a callback or return a promise or a stream. - * @param cb callback used to signal asynchronous completion. Caller includes err in case of error. - */ - (cb?:(err?:any)=>void): any; - } - - interface EventEmitter { - any: any; - } - - interface Gulp { - /** - * Define a task. - * - * @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them. - * @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()). - */ - task(name:string, fn:ITaskCallback): any; - - /** - * Define a task. - * - * @param name the name of the task. Tasks that you want to run from the command line should not have spaces in them. - * @param dep an array of tasks to be executed and completed before your task will run. - * @param fn the function that performs the task's operations. Generally this takes the form of gulp.src().pipe(someplugin()). - */ - task(name:string, dep:string[], fn?:ITaskCallback): any; - - - /** - * Takes a glob and represents a file structure. Can be piped to plugins. - * @param glob a glob string, using node-glob syntax - * @param opt an optional option object - */ - src(glob:string, opt?:ISrcOptions): NodeJS.ReadWriteStream; - - /** - * Takes a glob and represents a file structure. Can be piped to plugins. - * @param glob an array of glob strings, using node-glob syntax - * @param opt an optional option object - */ - src(glob:string[], opt?:ISrcOptions): NodeJS.ReadWriteStream; - - - /** - * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. - * Folders that don't exist will be created. - * - * @param outFolder the path (output folder) to write files to. - * @param opt - */ - dest(outFolder:string, opt?:IDestOptions): NodeJS.ReadWriteStream; - - /** - * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. - * Folders that don't exist will be created. - * - * @param outFolder a function that converts a vinyl File instance into an output path - * @param opt - */ - dest(outFolder:(file:string)=>string, opt?:IDestOptions): NodeJS.ReadWriteStream; - - - /** - * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. - * - * @param glob a single glob or array of globs that indicate which files to watch for changes. - * @param opt options, that are passed to the gaze library. - * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with gulp.task(). - */ - watch(glob:string, fn:(IWatchCallback|string)): EventEmitter; - watch(glob:string, fn:(IWatchCallback|string)[]): EventEmitter; - watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter; - watch(glob:string, opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter; - watch(glob:string[], fn:(IWatchCallback|string)): EventEmitter; - watch(glob:string[], fn:(IWatchCallback|string)[]): EventEmitter; - watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)): EventEmitter; - watch(glob:string[], opt:IWatchOptions, fn:(IWatchCallback|string)[]): EventEmitter; - } -} +/// declare module "gulp" { - var _tmp:gulp.Gulp; - export = _tmp; -} + import Orchestrator = require("orchestrator"); -interface IGulpPlugin { - (...args: any[]): NodeJS.ReadWriteStream; + namespace gulp { + interface Gulp extends Orchestrator { + /** + * Define a task + * @param name The name of the task. + * @param deps An array of task names to be executed and completed before your task will run. + * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete: + *
    + *
  • Take in a callback
  • + *
  • Return a stream or a promise
  • + *
+ */ + task: Orchestrator.AddMethod; + /** + * Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins. + * @param glob Glob or array of globs to read. + * @param opt Options to pass to node-glob through glob-stream. + */ + src: SrcMethod; + /** + * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. + * Folders that don't exist will be created. + * + * @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. + * @param opt + */ + dest: DestMethod; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param opt options, that are passed to the gaze library. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + watch: WatchMethod; + } + + interface IGulpPlugin { + (...args: any[]): NodeJS.ReadWriteStream; + } + + interface WatchMethod { + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string|string[], fn: (IWatchCallback|string)): NodeJS.EventEmitter; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string|string[], fn: (IWatchCallback|string)[]): NodeJS.EventEmitter; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param opt options, that are passed to the gaze library. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string|string[], opt: IWatchOptions, fn: (IWatchCallback|string)): NodeJS.EventEmitter; + /** + * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. + * + * @param glob a single glob or array of globs that indicate which files to watch for changes. + * @param opt options, that are passed to the gaze library. + * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). + */ + (glob: string|string[], opt: IWatchOptions, fn: (IWatchCallback|string)[]): NodeJS.EventEmitter; + + } + + interface DestMethod { + /** + * Can be piped to and it will write files. Re-emits all data passed to it so you can pipe to multiple folders. + * Folders that don't exist will be created. + * + * @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. + * @param opt + */ + (outFolder: string|((file:string)=>string), opt?: IDestOptions): NodeJS.ReadWriteStream; + } + + interface SrcMethod { + /** + * Emits files matching provided glob or an array of globs. Returns a stream of Vinyl files that can be piped to plugins. + * @param glob Glob or array of globs to read. + * @param opt Options to pass to node-glob through glob-stream. + */ + (glob: string|string[], opt?: ISrcOptions): NodeJS.ReadWriteStream; + } + + /** + * Options to pass to node-glob through glob-stream. + * Specifies two options in addition to those used by node-glob: + * https://github.com/isaacs/node-glob#options + */ + interface ISrcOptions { + /** + * Setting this to false will return file.contents as null + * and not read the file at all. + * Default: true. + */ + read?: boolean; + + /** + * Setting this to false will return file.contents as a stream and not buffer files. + * This is useful when working with large files. + * Note: Plugins might not implement support for streams. + * Default: true. + */ + buffer?: boolean; + + /** + * The base path of a glob. + * + * Default is everything before a glob starts. + */ + base?: string; + + /** + * The current working directory in which to search. + * Defaults to process.cwd(). + */ + cwd?: string; + + /** + * The place where patterns starting with / will be mounted onto. + * Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.) + */ + root?: string; + + /** + * Include .dot files in normal matches and globstar matches. + * Note that an explicit dot in a portion of the pattern will always match dot files. + */ + dot?: boolean; + + /** + * By default, a pattern starting with a forward-slash will be "mounted" onto the root setting, so that a valid + * filesystem path is returned. Set this flag to disable that behavior. + */ + nomount?: boolean; + + /** + * Add a / character to directory matches. Note that this requires additional stat calls. + */ + mark?: boolean; + + /** + * Don't sort the results. + */ + nosort?: boolean; + + /** + * Set to true to stat all results. This reduces performance somewhat, and is completely unnecessary, unless + * readdir is presumed to be an untrustworthy indicator of file existence. It will cause ELOOP to be triggered one + * level sooner in the case of cyclical symbolic links. + */ + stat?: boolean; + + /** + * When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr. + * Set the silent option to true to suppress these warnings. + */ + silent?: boolean; + + /** + * When an unusual error is encountered when attempting to read a directory, the process will just continue on in + * search of other matches. Set the strict option to raise an error in these cases. + */ + strict?: boolean; + + /** + * See cache property above. Pass in a previously generated cache object to save some fs calls. + */ + cache?: boolean; + + /** + * A cache of results of filesystem information, to prevent unnecessary stat calls. + * While it should not normally be necessary to set this, you may pass the statCache from one glob() call to the + * options object of another, if you know that the filesystem will not change between calls. + */ + statCache?: boolean; + + /** + * Perform a synchronous glob search. + */ + sync?: boolean; + + /** + * In some cases, brace-expanded patterns can result in the same file showing up multiple times in the result set. + * By default, this implementation prevents duplicates in the result set. Set this flag to disable that behavior. + */ + nounique?: boolean; + + /** + * Set to never return an empty set, instead returning a set containing the pattern itself. + * This is the default in glob(3). + */ + nonull?: boolean; + + /** + * Perform a case-insensitive match. Note that case-insensitive filesystems will sometimes result in glob returning + * results that are case-insensitively matched anyway, since readdir and stat will not raise an error. + */ + nocase?: boolean; + + /** + * Set to enable debug logging in minimatch and glob. + */ + debug?: boolean; + + /** + * Set to enable debug logging in glob, but not minimatch. + */ + globDebug?: boolean; + } + + interface IDestOptions { + /** + * The output folder. Only has an effect if provided output folder is relative. + * Default: process.cwd() + */ + cwd?: string; + + /** + * Octal permission string specifying mode for any folders that need to be created for output folder. + * Default: 0777. + */ + mode?: string; + } + + /** + * Options that are passed to gaze. + * https://github.com/shama/gaze + */ + interface IWatchOptions { + /** Interval to pass to fs.watchFile. */ + interval?: number; + /** Delay for events called in succession for the same file/event. */ + debounceDelay?: number; + /** Force the watch mode. Either 'auto' (default), 'watch' (force native events), or 'poll' (force stat polling). */ + mode?: string; + /** The current working directory to base file patterns from. Default is process.cwd().. */ + cwd?: string; + } + + interface IWatchEvent { + /** The type of change that occurred, either added, changed or deleted. */ + type: string; + /** The path to the file that triggered the event. */ + path: string; + } + + /** + * Callback to be called on each watched file change. + */ + interface IWatchCallback { + (event:IWatchEvent): void; + } + + interface ITaskCallback { + /** + * Defines a task. + * Tasks may be made asynchronous if they are passing a callback or return a promise or a stream. + * @param cb callback used to signal asynchronous completion. Caller includes err in case of error. + */ + (cb?:(err?:any)=>void): any; + } + } + + var gulp: gulp.Gulp; + + export = gulp; } diff --git a/run-sequence/run-sequence-tests.ts b/run-sequence/run-sequence-tests.ts index 98e57d9f3..edc3266e9 100644 --- a/run-sequence/run-sequence-tests.ts +++ b/run-sequence/run-sequence-tests.ts @@ -5,7 +5,7 @@ import gulp = require("gulp"); import tmp = require("run-sequence"); var runSequence = tmp.use(gulp); -gulp.task("run-sequence", callback => { +gulp.task("run-sequence", (callback: any) => { runSequence("task1", ["task2", "task3"], "taks4", diff --git a/run-sequence/run-sequence.d.ts b/run-sequence/run-sequence.d.ts index 3a2cb449c..221ff270e 100644 --- a/run-sequence/run-sequence.d.ts +++ b/run-sequence/run-sequence.d.ts @@ -7,6 +7,7 @@ /// declare module "run-sequence" { + import gulp = require('gulp'); interface IRunSequence { (...streams: (string | string[] | gulp.ITaskCallback)[]): NodeJS.ReadWriteStream; From 052725d74978d6b8d7c4ff537b5a3b21ee755a49 Mon Sep 17 00:00:00 2001 From: tkQubo Date: Fri, 21 Aug 2015 13:02:41 +0900 Subject: [PATCH 010/167] Change interface name (remove the first letter 'I') --- gulp-protractor/gulp-protractor.d.ts | 4 ++-- gulp-tsd/gulp-tsd.d.ts | 2 +- gulp/gulp-tests.ts | 4 ++-- gulp/gulp.d.ts | 30 ++++++++++++++-------------- run-sequence/run-sequence.d.ts | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/gulp-protractor/gulp-protractor.d.ts b/gulp-protractor/gulp-protractor.d.ts index 4ac814780..fd98dbd43 100644 --- a/gulp-protractor/gulp-protractor.d.ts +++ b/gulp-protractor/gulp-protractor.d.ts @@ -18,8 +18,8 @@ declare module 'gulp-protractor' { interface IGulpProtractor { getProtractorDir(): string; protractor(options?: IOptions): NodeJS.ReadWriteStream; - webdriver_standalone: gulp.ITaskCallback; - webdriver_update: gulp.ITaskCallback; + webdriver_standalone: gulp.TaskCallback; + webdriver_update: gulp.TaskCallback; } var protractor: IGulpProtractor; diff --git a/gulp-tsd/gulp-tsd.d.ts b/gulp-tsd/gulp-tsd.d.ts index 20d279329..816d50d25 100644 --- a/gulp-tsd/gulp-tsd.d.ts +++ b/gulp-tsd/gulp-tsd.d.ts @@ -16,7 +16,7 @@ declare module "gulp-tsd" { opts?: Object; } - function tsd(opts?: IOptions, callback?: gulp.ITaskCallback): NodeJS.ReadWriteStream; + function tsd(opts?: IOptions, callback?: gulp.TaskCallback): NodeJS.ReadWriteStream; export = tsd; } diff --git a/gulp/gulp-tests.ts b/gulp/gulp-tests.ts index 2a69d40ca..d00690881 100644 --- a/gulp/gulp-tests.ts +++ b/gulp/gulp-tests.ts @@ -4,8 +4,8 @@ import gulp = require("gulp"); import browserSync = require("browser-sync"); -var typescript: gulp.IGulpPlugin = null; // this would be the TypeScript compiler -var jasmine: gulp.IGulpPlugin = null; // this would be the jasmine test runner +var typescript: gulp.GulpPlugin = null; // this would be the TypeScript compiler +var jasmine: gulp.GulpPlugin = null; // this would be the jasmine test runner gulp.task('compile', function() { diff --git a/gulp/gulp.d.ts b/gulp/gulp.d.ts index abb8978d1..160ee99ce 100644 --- a/gulp/gulp.d.ts +++ b/gulp/gulp.d.ts @@ -46,7 +46,7 @@ declare module "gulp" { watch: WatchMethod; } - interface IGulpPlugin { + interface GulpPlugin { (...args: any[]): NodeJS.ReadWriteStream; } @@ -57,14 +57,14 @@ declare module "gulp" { * @param glob a single glob or array of globs that indicate which files to watch for changes. * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). */ - (glob: string|string[], fn: (IWatchCallback|string)): NodeJS.EventEmitter; + (glob: string|string[], fn: (WatchCallback|string)): NodeJS.EventEmitter; /** * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. * * @param glob a single glob or array of globs that indicate which files to watch for changes. * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). */ - (glob: string|string[], fn: (IWatchCallback|string)[]): NodeJS.EventEmitter; + (glob: string|string[], fn: (WatchCallback|string)[]): NodeJS.EventEmitter; /** * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. * @@ -72,7 +72,7 @@ declare module "gulp" { * @param opt options, that are passed to the gaze library. * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). */ - (glob: string|string[], opt: IWatchOptions, fn: (IWatchCallback|string)): NodeJS.EventEmitter; + (glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)): NodeJS.EventEmitter; /** * Watch files and do something when a file changes. This always returns an EventEmitter that emits change events. * @@ -80,7 +80,7 @@ declare module "gulp" { * @param opt options, that are passed to the gaze library. * @param fn a callback or array of callbacks to be called on each change, or names of task(s) to run when a file changes, added with task(). */ - (glob: string|string[], opt: IWatchOptions, fn: (IWatchCallback|string)[]): NodeJS.EventEmitter; + (glob: string|string[], opt: WatchOptions, fn: (WatchCallback|string)[]): NodeJS.EventEmitter; } @@ -92,7 +92,7 @@ declare module "gulp" { * @param outFolder The path (output folder) to write files to. Or a function that returns it, the function will be provided a vinyl File instance. * @param opt */ - (outFolder: string|((file:string)=>string), opt?: IDestOptions): NodeJS.ReadWriteStream; + (outFolder: string|((file: string) => string), opt?: DestOptions): NodeJS.ReadWriteStream; } interface SrcMethod { @@ -101,7 +101,7 @@ declare module "gulp" { * @param glob Glob or array of globs to read. * @param opt Options to pass to node-glob through glob-stream. */ - (glob: string|string[], opt?: ISrcOptions): NodeJS.ReadWriteStream; + (glob: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream; } /** @@ -109,7 +109,7 @@ declare module "gulp" { * Specifies two options in addition to those used by node-glob: * https://github.com/isaacs/node-glob#options */ - interface ISrcOptions { + interface SrcOptions { /** * Setting this to false will return file.contents as null * and not read the file at all. @@ -231,7 +231,7 @@ declare module "gulp" { globDebug?: boolean; } - interface IDestOptions { + interface DestOptions { /** * The output folder. Only has an effect if provided output folder is relative. * Default: process.cwd() @@ -249,7 +249,7 @@ declare module "gulp" { * Options that are passed to gaze. * https://github.com/shama/gaze */ - interface IWatchOptions { + interface WatchOptions { /** Interval to pass to fs.watchFile. */ interval?: number; /** Delay for events called in succession for the same file/event. */ @@ -260,7 +260,7 @@ declare module "gulp" { cwd?: string; } - interface IWatchEvent { + interface WatchEvent { /** The type of change that occurred, either added, changed or deleted. */ type: string; /** The path to the file that triggered the event. */ @@ -270,17 +270,17 @@ declare module "gulp" { /** * Callback to be called on each watched file change. */ - interface IWatchCallback { - (event:IWatchEvent): void; + interface WatchCallback { + (event: WatchEvent): void; } - interface ITaskCallback { + interface TaskCallback { /** * Defines a task. * Tasks may be made asynchronous if they are passing a callback or return a promise or a stream. * @param cb callback used to signal asynchronous completion. Caller includes err in case of error. */ - (cb?:(err?:any)=>void): any; + (cb?: (err?: any) => void): any; } } diff --git a/run-sequence/run-sequence.d.ts b/run-sequence/run-sequence.d.ts index 221ff270e..4507e80c0 100644 --- a/run-sequence/run-sequence.d.ts +++ b/run-sequence/run-sequence.d.ts @@ -10,7 +10,7 @@ declare module "run-sequence" { import gulp = require('gulp'); interface IRunSequence { - (...streams: (string | string[] | gulp.ITaskCallback)[]): NodeJS.ReadWriteStream; + (...streams: (string | string[] | gulp.TaskCallback)[]): NodeJS.ReadWriteStream; use(gulp: gulp.Gulp): IRunSequence; } From 6ee9ce6f2918806e8c005e006809b4be961914f8 Mon Sep 17 00:00:00 2001 From: tkQubo Date: Wed, 26 Aug 2015 01:52:37 +0900 Subject: [PATCH 011/167] Add type annotation for some cbs --- gulp-istanbul/gulp-istanbul-tests.ts | 8 ++++---- gulp-watch/gulp-watch-tests.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gulp-istanbul/gulp-istanbul-tests.ts b/gulp-istanbul/gulp-istanbul-tests.ts index 0d64b53d0..aada03de1 100644 --- a/gulp-istanbul/gulp-istanbul-tests.ts +++ b/gulp-istanbul/gulp-istanbul-tests.ts @@ -7,7 +7,7 @@ function testFramework(): NodeJS.ReadWriteStream { return null; } -gulp.task('test', function (cb) { +gulp.task('test', function (cb: Function) { gulp.src(['lib/**/*.js', 'main.js']) .pipe(istanbul()) // Covering files .pipe(gulp.dest('test-tmp/')) @@ -19,7 +19,7 @@ gulp.task('test', function (cb) { }); }); -gulp.task('test', function (cb) { +gulp.task('test', function (cb: Function) { gulp.src(['lib/**/*.js', 'main.js']) .pipe(istanbul({includeUntested: true})) // Covering files .pipe(istanbul.hookRequire()) @@ -31,7 +31,7 @@ gulp.task('test', function (cb) { }); }); -gulp.task('test', function (cb) { +gulp.task('test', function (cb: Function) { gulp.src(['lib/**/*.js', 'main.js']) .pipe(istanbul({includeUntested: true})) // Covering files .pipe(istanbul.hookRequire()) @@ -42,4 +42,4 @@ gulp.task('test', function (cb) { .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // .on('end', cb); }); -}); \ No newline at end of file +}); diff --git a/gulp-watch/gulp-watch-tests.ts b/gulp-watch/gulp-watch-tests.ts index 9d9303ac2..dd237dccc 100644 --- a/gulp-watch/gulp-watch-tests.ts +++ b/gulp-watch/gulp-watch-tests.ts @@ -10,7 +10,7 @@ gulp.task('stream', () => .pipe(gulp.dest('build')) ); -gulp.task('callback', (cb) => +gulp.task('callback', (cb: Function) => watch('css/**/*.css', () => gulp.src('css/**/*.css') .pipe(watch('css/**/*.css')) From c340b3634c93a8dbf1c40cf1d7f82f8101fe9200 Mon Sep 17 00:00:00 2001 From: Anthony Guo Date: Mon, 10 Aug 2015 16:40:09 -0700 Subject: [PATCH 012/167] Added typings for the CodeMirror showhint addon --- codemirror/showhint-tests.ts | 33 +++++++++++++++++++ codemirror/showhint.d.ts | 62 ++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 codemirror/showhint-tests.ts create mode 100644 codemirror/showhint.d.ts diff --git a/codemirror/showhint-tests.ts b/codemirror/showhint-tests.ts new file mode 100644 index 000000000..b7378e0d6 --- /dev/null +++ b/codemirror/showhint-tests.ts @@ -0,0 +1,33 @@ +/// +/// +var doc = new CodeMirror.Doc('text'); +var pos = new CodeMirror.Pos(2, 3); +CodeMirror.showHint(doc); +CodeMirror.showHint(doc, function (cm) { + return { + from: pos, + list: ["one", "two"], + to: pos + }; +}); +CodeMirror.showHint(doc, function (cm) { + return { + from: pos, + list: [ + { + text: "disp1", + render: function (el, self, data) { + ; + } + }, + { + className: "class2", + displayText: "disp2", + from: pos, + to: pos, + text: "sometext" + } + ], + to: pos + }; +}); diff --git a/codemirror/showhint.d.ts b/codemirror/showhint.d.ts new file mode 100644 index 000000000..340871db4 --- /dev/null +++ b/codemirror/showhint.d.ts @@ -0,0 +1,62 @@ +// Type definitions for CodeMirror +// Project: https://github.com/marijnh/CodeMirror +// Definitions by: jacqt +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module CodeMirror { + var commands : any; + + /** Provides a framework for showing autocompletion hints. Defines editor.showHint, which takes an optional + options object, and pops up a widget that allows the user to select a completion. Finding hints is done with + a hinting functions (the hint option), which is a function that take an editor instance and options object, + and return a {list, from, to} object, where list is an array of strings or objects (the completions), and + from and to give the start and end of the token that is being completed as {line, ch} objects. An optional + selectedHint property (an integer) can be added to the completion object to control the initially selected hint. */ + function showHint (cm: CodeMirror.Doc, hinter?: (doc : CodeMirror.Doc) => Hints, options?: IShowHintOptions) : void; + + + interface Hints { + from: Position; + to: Position; + list: Hint[] | string[]; + } + + /** Interface used by showHint.js Codemirror add-on + When completions aren't simple strings, they should be objects with the following properties: */ + interface Hint { + text: string; + className?: string; + displayText?: string; + from?: Position; + render?: (element: any, self: any, data: any) => void; + to?: Position; + } + + interface Editor { + /** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */ + on(eventName: string, handler: (doc: CodeMirror.Doc, event : any ) => void ): void; + off(eventName: string, handler: (doc: CodeMirror.Doc, event : any) => void ): void; + } + + /** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/ + interface Doc { + state: any; + showHint: (options: IShowHintOptions) => void; + } + + interface IShowHintOptions { + completeSingle: boolean; + hint: (doc : CodeMirror.Doc) => Hints; + } + + /** The Handle used to interact with the autocomplete dialog box.*/ + interface Handle { + moveFocus(n: number, avoidWrap: boolean): void; + setFocus(n: number): void; + menuSize(): number; + length: number; + close(): void; + pick(): void; + data: any; + } +} From 1613bfdbda9f1d2704b682fe342c2234760904c5 Mon Sep 17 00:00:00 2001 From: Scott Hatcher Date: Tue, 25 Aug 2015 15:41:27 -0700 Subject: [PATCH 013/167] Initial push for highcharts-ng definitions and tests. --- highcharts-ng/highcharts-ng-tests.ts | 40 ++++++++++++++++++++++++++++ highcharts-ng/highcharts-ng.d.ts | 37 +++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 highcharts-ng/highcharts-ng-tests.ts create mode 100644 highcharts-ng/highcharts-ng.d.ts diff --git a/highcharts-ng/highcharts-ng-tests.ts b/highcharts-ng/highcharts-ng-tests.ts new file mode 100644 index 000000000..2fe0ae906 --- /dev/null +++ b/highcharts-ng/highcharts-ng-tests.ts @@ -0,0 +1,40 @@ +/// +/// + +var app = angular.module('app', ['highcharts-ng']); + +class AppController { + chartConfig: HighChartsNGConfig = { + options: { + chart: { + type: 'bar' + }, + tooltip: { + style: { + padding: 10, + fontWeight: 'bold' + } + }, + credits: { + enabled: false + }, + plotOptions: {} + }, + series: [{ + data: [10, 15, 12, 8, 7] + }], + title: { + text: 'My Awesome Chart' + }, + loading: true + }; + constructor($timeout: ng.ITimeoutService) { + let vm = this; + $timeout(function() { + //Some async action + vm.chartConfig.loading = false; + }); + } +} + +app.controller("AppController", AppController); \ No newline at end of file diff --git a/highcharts-ng/highcharts-ng.d.ts b/highcharts-ng/highcharts-ng.d.ts new file mode 100644 index 000000000..216d8fbfc --- /dev/null +++ b/highcharts-ng/highcharts-ng.d.ts @@ -0,0 +1,37 @@ +// Type definitions for highcharts-ng 0.0.8 +// Project: https://github.com/pablojim/highcharts-ng +// Definitions by: Scott Hatcher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface HighChartsNGConfig { + options: HighchartsChartOptions; + //The below properties are watched separately for changes. + + //Series object (optional) - a list of series using normal highcharts series options. + series?: number[]|[number, number][]| HighchartsDataPoint[]; + //Title configuration (optional) + title?: { + text?: string; + }; + //Boolean to control showng loading status on chart (optional) + //Could be a string if you want to show specific loading text. + loading?: boolean; + //Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled. + //properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum + xAxis?: { + currentMin?: number; + currentMax?: number; + title?: { text?: string } + }, + //Whether to use HighStocks instead of HighCharts (optional). Defaults to false. + useHighStocks?: boolean; + //size (optional) if left out the chart will default to size of the div or something sensible. + size?: { + width?: number; + height?: number; + }; + //function (optional) - setup some logic for the chart + func?: (chart) => void; +} \ No newline at end of file From 29f7e2fe49c25073e26f0a3757a70e2a052d02fa Mon Sep 17 00:00:00 2001 From: Scott Hatcher Date: Tue, 25 Aug 2015 16:02:15 -0700 Subject: [PATCH 014/167] Added instantiated version of chart definition and cleaned up tests. --- highcharts-ng/highcharts-ng-tests.ts | 2 +- highcharts-ng/highcharts-ng.d.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/highcharts-ng/highcharts-ng-tests.ts b/highcharts-ng/highcharts-ng-tests.ts index 2fe0ae906..7fb462e9c 100644 --- a/highcharts-ng/highcharts-ng-tests.ts +++ b/highcharts-ng/highcharts-ng-tests.ts @@ -29,7 +29,7 @@ class AppController { loading: true }; constructor($timeout: ng.ITimeoutService) { - let vm = this; + var vm = this; $timeout(function() { //Some async action vm.chartConfig.loading = false; diff --git a/highcharts-ng/highcharts-ng.d.ts b/highcharts-ng/highcharts-ng.d.ts index 216d8fbfc..b67ca5da5 100644 --- a/highcharts-ng/highcharts-ng.d.ts +++ b/highcharts-ng/highcharts-ng.d.ts @@ -33,5 +33,11 @@ interface HighChartsNGConfig { height?: number; }; //function (optional) - setup some logic for the chart - func?: (chart) => void; + func?: (chart: HighchartsChartObject) => void; +} + +//Instantiated Chart +interface HighChartsNGChart extends HighChartsNGConfig { + //This is a simple way to access all the Highcharts API that is not currently managed by this directive. + getHighcharts(): HighchartsChartObject; } \ No newline at end of file From a20f2d808f2a85ef6483fe01fbf6169f0aedea94 Mon Sep 17 00:00:00 2001 From: Scott Hatcher Date: Tue, 25 Aug 2015 16:48:13 -0700 Subject: [PATCH 015/167] Moved from tab spacing. --- highcharts-ng/highcharts-ng-tests.ts | 54 +++++++++++++------------- highcharts-ng/highcharts-ng.d.ts | 58 ++++++++++++++-------------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/highcharts-ng/highcharts-ng-tests.ts b/highcharts-ng/highcharts-ng-tests.ts index 7fb462e9c..5f05b3373 100644 --- a/highcharts-ng/highcharts-ng-tests.ts +++ b/highcharts-ng/highcharts-ng-tests.ts @@ -4,37 +4,37 @@ var app = angular.module('app', ['highcharts-ng']); class AppController { - chartConfig: HighChartsNGConfig = { - options: { - chart: { - type: 'bar' - }, - tooltip: { - style: { - padding: 10, - fontWeight: 'bold' - } - }, - credits: { - enabled: false - }, - plotOptions: {} - }, - series: [{ + chartConfig: HighChartsNGConfig = { + options: { + chart: { + type: 'bar' + }, + tooltip: { + style: { + padding: 10, + fontWeight: 'bold' + } + }, + credits: { + enabled: false + }, + plotOptions: {} + }, + series: [{ data: [10, 15, 12, 8, 7] }], - title: { + title: { text: 'My Awesome Chart' }, - loading: true - }; - constructor($timeout: ng.ITimeoutService) { - var vm = this; - $timeout(function() { - //Some async action - vm.chartConfig.loading = false; - }); - } + loading: true + }; + constructor($timeout: ng.ITimeoutService) { + var vm = this; + $timeout(function() { + //Some async action + vm.chartConfig.loading = false; + }); + } } app.controller("AppController", AppController); \ No newline at end of file diff --git a/highcharts-ng/highcharts-ng.d.ts b/highcharts-ng/highcharts-ng.d.ts index b67ca5da5..d0a340559 100644 --- a/highcharts-ng/highcharts-ng.d.ts +++ b/highcharts-ng/highcharts-ng.d.ts @@ -6,38 +6,38 @@ /// interface HighChartsNGConfig { - options: HighchartsChartOptions; - //The below properties are watched separately for changes. + options: HighchartsChartOptions; + //The below properties are watched separately for changes. - //Series object (optional) - a list of series using normal highcharts series options. - series?: number[]|[number, number][]| HighchartsDataPoint[]; - //Title configuration (optional) - title?: { - text?: string; - }; - //Boolean to control showng loading status on chart (optional) - //Could be a string if you want to show specific loading text. - loading?: boolean; - //Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled. - //properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum - xAxis?: { - currentMin?: number; - currentMax?: number; - title?: { text?: string } - }, - //Whether to use HighStocks instead of HighCharts (optional). Defaults to false. - useHighStocks?: boolean; - //size (optional) if left out the chart will default to size of the div or something sensible. - size?: { - width?: number; - height?: number; - }; - //function (optional) - setup some logic for the chart - func?: (chart: HighchartsChartObject) => void; + //Series object (optional) - a list of series using normal highcharts series options. + series?: number[]|[number, number][]| HighchartsDataPoint[]; + //Title configuration (optional) + title?: { + text?: string; + }; + //Boolean to control showng loading status on chart (optional) + //Could be a string if you want to show specific loading text. + loading?: boolean; + //Configuration for the xAxis (optional). Currently only one x axis can be dynamically controlled. + //properties currentMin and currentMax provied 2-way binding to the chart's maximimum and minimum + xAxis?: { + currentMin?: number; + currentMax?: number; + title?: { text?: string } + }, + //Whether to use HighStocks instead of HighCharts (optional). Defaults to false. + useHighStocks?: boolean; + //size (optional) if left out the chart will default to size of the div or something sensible. + size?: { + width?: number; + height?: number; + }; + //function (optional) - setup some logic for the chart + func?: (chart: HighchartsChartObject) => void; } //Instantiated Chart interface HighChartsNGChart extends HighChartsNGConfig { - //This is a simple way to access all the Highcharts API that is not currently managed by this directive. - getHighcharts(): HighchartsChartObject; + //This is a simple way to access all the Highcharts API that is not currently managed by this directive. + getHighcharts(): HighchartsChartObject; } \ No newline at end of file From 2e8850e4d90f4a41a0901cbded737f865a0867f5 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 26 Aug 2015 06:00:31 +0500 Subject: [PATCH 016/167] lodash: changed _.capitalize() method --- lodash/lodash-tests.ts | 2 ++ lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bb7a66560..3ec1bb1a3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1755,7 +1755,9 @@ result = _.uniqueId(); result = _.camelCase('Foo Bar'); result = _('Foo Bar').camelCase(); +// _.capitalize result = _.capitalize('fred'); +result = _('fred').capitalize(); // _.deburr result = _.deburr('déjà vu'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 43ba61f3b..e87b3eadf 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7583,8 +7583,16 @@ declare module _ { camelCase(): string; } + //_.capitalize interface LoDashStatic { - capitalize(str?: string): string; + capitalize(string?: string): string; + } + + interface LoDashWrapper { + /** + * @see _.capitalize + */ + capitalize(): string; } //_.deburr From 5c4be3d2ae5fa3e81aa682733af238b1e335a656 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 26 Aug 2015 06:08:06 +0500 Subject: [PATCH 017/167] lodash: changed _.isNull() method --- lodash/lodash-tests.ts | 9 ++++++--- lodash/lodash.d.ts | 27 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bb7a66560..23edca934 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1260,6 +1260,12 @@ result = _(undefined).isNaN(); result = _.isNative(Array.prototype.push); result = _(Array.prototype.push).isNative(); +// _.isNull +result = _.isNull(any); +result = _(1).isNull(); +result = _([]).isNull(); +result = _({}).isNull(); + // _.isNumber result = _.isNumber(any); result = _(1).isNumber(); @@ -1502,9 +1508,6 @@ result = _(testEqArray).isEqual(testEqOtherArray, testEqCustomizerFn); result = _.eq(testEqArray, testEqOtherArray, testEqCustomizerFn); result = _(testEqArray).eq(testEqOtherArray, testEqCustomizerFn); -result = _.isNull(null); -result = _.isNull(undefined); - result = _.isObject({}); result = _.isObject([1, 2, 3]); result = _.isObject(1); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 43ba61f3b..03aacca50 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6346,6 +6346,23 @@ declare module _ { isNative(): boolean; } + //_.isNull + interface LoDashStatic { + /** + * Checks if value is null. + * @param value The value to check. + * @return Returns true if value is null, else false. + **/ + isNull(value?: any): boolean; + } + + interface LoDashWrapperBase { + /** + * see _.isNull + */ + isNull(): boolean; + } + //_.isNumber interface LoDashStatic { /** @@ -7163,16 +7180,6 @@ declare module _ { thisArg?: any): boolean; } - //_.isNull - interface LoDashStatic { - /** - * Checks if value is null. - * @param value The value to check. - * @return True if the value is null, else false. - **/ - isNull(value?: any): boolean; - } - //_.isObject interface LoDashStatic { /** From 534746f21901ac44b5fc90113649f615ab24d86d Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Wed, 26 Aug 2015 14:35:44 +0900 Subject: [PATCH 018/167] fix indent level --- .../{sequelize-test.ts => sequelize-tests.ts} | 5 +- sequelize/sequelize.d.ts | 370 +++++++++--------- 2 files changed, 189 insertions(+), 186 deletions(-) rename sequelize/{sequelize-test.ts => sequelize-tests.ts} (99%) diff --git a/sequelize/sequelize-test.ts b/sequelize/sequelize-tests.ts similarity index 99% rename from sequelize/sequelize-test.ts rename to sequelize/sequelize-tests.ts index e5656c76e..2651453d6 100644 --- a/sequelize/sequelize-test.ts +++ b/sequelize/sequelize-tests.ts @@ -47,11 +47,14 @@ interface GTaskAttributes { revision? : number; name? : string; } -interface GTaskInstance extends Sequelize.Instance {} +interface GTaskInstance extends Sequelize.Instance { + upRevision(): void; +} var GTask = s.define( 'task', { revision : Sequelize.INTEGER, name : Sequelize.STRING }); GUser.hasMany(GTask); +GTask.create({ revision: 1, name: 'test' }).then( (gtask) => gtask.upRevision() ); // diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 4c2294e6f..0e84373a6 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -256,13 +256,13 @@ declare module "sequelize" { * user.getProfilePicture() // gets you only the profile picture * * User.findAll({ - * where: ..., - * include: [ - * { model: Picture }, // load all pictures - * { model: Picture, as: 'ProfilePicture' }, // load the profile picture. Notice that the spelling must be - * the exact same as the one in the association - * ] - * }) + * where: ..., + * include: [ + * { model: Picture }, // load all pictures + * { model: Picture, as: 'ProfilePicture' }, // load the profile picture. Notice that the spelling must be + * the exact same as the one in the association + * ] + * }) * ``` * To get full control over the foreign key column added by sequelize, you can use the `foreignKey` option. It * can either be a string, that specifies the name, or and object type definition, @@ -276,11 +276,11 @@ declare module "sequelize" { * * ```js * User.hasMany(Picture, { - * foreignKey: { - * name: 'uid', - * allowNull: false - * } - * }) + * foreignKey: { + * name: 'uid', + * allowNull: false + * } + * }) * ``` * * This specifies that the `uid` column can not be null. In most cases this will already be covered by the @@ -293,10 +293,10 @@ declare module "sequelize" { * * ```js * user.getPictures({ - * where: { - * format: 'jpg' - * } - * }) + * where: { + * format: 'jpg' + * } + * }) * ``` * * There are several ways to update and add new assoications. Continuing with our example of users and @@ -371,8 +371,8 @@ declare module "sequelize" { * started yet: * ```js * var UserProjects = sequelize.define('userprojects', { - * started: Sequelize.BOOLEAN - * }) + * started: Sequelize.BOOLEAN + * }) * User.hasMany(Project, { through: UserProjects }) * Project.hasMany(User, { through: UserProjects }) * ``` @@ -387,8 +387,8 @@ declare module "sequelize" { * * ```js * p1.userprojects { - * started: true - * } + * started: true + * } * user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that. * ``` * @@ -396,9 +396,9 @@ declare module "sequelize" { * available as an object with the name of the through model. * ```js * user.getProjects().then(function (projects) { - * var p1 = projects[0] - * p1.userprojects.started // Is this project started yet? - * }) + * var p1 = projects[0] + * p1.userprojects.started // Is this project started yet? + * }) * ``` * * @param target The model that will be associated with hasOne relationship @@ -421,8 +421,8 @@ declare module "sequelize" { * the project has been started yet: * ```js * var UserProjects = sequelize.define('userprojects', { - * started: Sequelize.BOOLEAN - * }) + * started: Sequelize.BOOLEAN + * }) * User.belongsToMany(Project, { through: UserProjects }) * Project.belongsToMany(User, { through: UserProjects }) * ``` @@ -436,8 +436,8 @@ declare module "sequelize" { * * ```js * p1.userprojects { - * started: true - * } + * started: true + * } * user.setProjects([p1, p2], {started: false}) // The default value is false, but p1 overrides that. * ``` * @@ -445,9 +445,9 @@ declare module "sequelize" { * available as an object with the name of the through model. * ```js * user.getProjects().then(function (projects) { - * var p1 = projects[0] - * p1.userprojects.started // Is this project started yet? - * }) + * var p1 = projects[0] + * p1.userprojects.started // Is this project started yet? + * }) * ``` * * @param target The model that will be associated with hasOne relationship @@ -813,15 +813,15 @@ declare module "sequelize" { * * ```js * sequelize.define('Model', { - * foreign_id: { - * type: Sequelize.INTEGER, - * references: { - * model: OtherModel, - * key: 'id', - * deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE - * } - * } - * }); + * foreign_id: { + * type: Sequelize.INTEGER, + * references: { + * model: OtherModel, + * key: 'id', + * deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE + * } + * } + * }); * ``` * * The constraints can be configured in a transaction like this. It will @@ -1074,16 +1074,16 @@ declare module "sequelize" { * ```js * // Method 1 * sequelize.define(name, { attributes }, { - * hooks: { - * beforeBulkCreate: function () { - * // can be a single function - * }, - * beforeValidate: [ - * function () {}, - * function() {} // Or an array of several - * ] - * } - * }) + * hooks: { + * beforeBulkCreate: function () { + * // can be a single function + * }, + * beforeValidate: [ + * function () {}, + * function() {} // Or an array of several + * ] + * } + * }) * * // Method 2 * Model.hook('afterDestroy', function () {}) @@ -2439,32 +2439,32 @@ declare module "sequelize" { * Apply a scope created in `define` to the model. First let's look at how to create scopes: * ```js * var Model = sequelize.define('model', attributes, { - * defaultScope: { - * where: { - * username: 'dan' - * }, - * limit: 12 - * }, - * scopes: { - * isALie: { - * where: { - * stuff: 'cake' - * } - * }, - * complexFunction: function(email, accessLevel) { - * return { - * where: { - * email: { - * $like: email - * }, - * accesss_level { - * $gte: accessLevel - * } - * } - * } - * } - * } - * }) + * defaultScope: { + * where: { + * username: 'dan' + * }, + * limit: 12 + * }, + * scopes: { + * isALie: { + * where: { + * stuff: 'cake' + * } + * }, + * complexFunction: function(email, accessLevel) { + * return { + * where: { + * email: { + * $like: email + * }, + * accesss_level { + * $gte: accessLevel + * } + * } + * } + * } + * } + * }) * ``` * Now, since you defined a default scope, every time you do Model.find, the default scope is appended to * your query. Here's a couple of examples: @@ -2490,11 +2490,11 @@ declare module "sequelize" { * __Simple search using AND and =__ * ```js * Model.findAll({ - * where: { - * attr1: 42, - * attr2: 'cake' - * } - * }) + * where: { + * attr1: 42, + * attr2: 'cake' + * } + * }) * ``` * ```sql * WHERE attr1 = 42 AND attr2 = 'cake' @@ -2504,21 +2504,21 @@ declare module "sequelize" { * ```js * * Model.findAll({ - * where: { - * attr1: { - * gt: 50 - * }, - * attr2: { - * lte: 45 - * }, - * attr3: { - * in: [1,2,3] - * }, - * attr4: { - * ne: 5 - * } - * } - * }) + * where: { + * attr1: { + * gt: 50 + * }, + * attr2: { + * lte: 45 + * }, + * attr3: { + * in: [1,2,3] + * }, + * attr4: { + * ne: 5 + * } + * } + * }) * ``` * ```sql * WHERE attr1 > 50 AND attr2 <= 45 AND attr3 IN (1,2,3) AND attr4 != 5 @@ -2529,14 +2529,14 @@ declare module "sequelize" { * __Queries using OR__ * ```js * Model.findAll({ - * where: Sequelize.and( - * { name: 'a project' }, - * Sequelize.or( - * { id: [1,2,3] }, - * { id: { gt: 10 } } - * ) - * ) - * }) + * where: Sequelize.and( + * { name: 'a project' }, + * Sequelize.or( + * { id: [1,2,3] }, + * { id: { gt: 10 } } + * ) + * ) + * }) * ``` * ```sql * WHERE name = 'a project' AND (id` IN (1,2,3) OR id > 10) @@ -2587,12 +2587,12 @@ declare module "sequelize" { * * ```js * Model.findAndCountAll({ - * where: ..., - * limit: 12, - * offset: 12 - * }).then(function (result) { - * ... - * }) + * where: ..., + * limit: 12, + * offset: 12 + * }).then(function (result) { + * ... + * }) * ``` * In the above example, `result.rows` will contain rows 13 through 24, while `result.count` will return * the @@ -2605,11 +2605,11 @@ declare module "sequelize" { * Suppose you want to find all users who have a profile attached: * ```js * User.findAndCountAll({ - * include: [ - * { model: Profile, required: true} - * ], - * limit 3 - * }); + * include: [ + * { model: Profile, required: true} + * ], + * limit 3 + * }); * ``` * Because the include for `Profile` has `required` set it will result in an inner join, and only the users * who have a profile will be counted. If we remove `required` from the include, both users with and @@ -3149,7 +3149,7 @@ declare module "sequelize" { /** * A string or a data type */ - type: string | DataTypeAbstract; + type: string | DataTypeAbstract; /** * If true, the column will get a unique constraint. If a string is provided, the column will be part of a @@ -3218,11 +3218,11 @@ declare module "sequelize" { * * ```js * sequelize.define('model', { - * states: { - * type: Sequelize.ENUM, - * values: ['active', 'pending', 'deleted'] - * } - * }) + * states: { + * type: Sequelize.ENUM, + * values: ['active', 'pending', 'deleted'] + * } + * }) * ``` */ values? : Array; @@ -3265,7 +3265,7 @@ declare module "sequelize" { * The type of query you are executing. The query type affects how results are formatted before they are * passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts. */ - type?: string; + type?: string; /** * If true, transforms objects with `.` separated property names into nested objects using @@ -4042,8 +4042,8 @@ declare module "sequelize" { * Convert a user's username to upper case * ```js * instance.updateAttributes({ - * username: self.sequelize.fn('upper', self.sequelize.col('username')) - * }) + * username: self.sequelize.fn('upper', self.sequelize.col('username')) + * }) * ``` * @param fn The function you want to call * @param args All further arguments will be passed as arguments to the function @@ -4211,22 +4211,22 @@ declare module "sequelize" { * * ```js * sequelize.define('modelName', { - * columnA: { - * type: Sequelize.BOOLEAN, - * validate: { - * is: ["[a-z]",'i'], // will only allow letters - * max: 23, // only allow values <= 23 - * isIn: { - * args: [['en', 'zh']], - * msg: "Must be English or Chinese" - * } - * }, - * field: 'column_a' - * // Other attributes here - * }, - * columnB: Sequelize.STRING, - * columnC: 'MY VERY OWN COLUMN TYPE' - * }) + * columnA: { + * type: Sequelize.BOOLEAN, + * validate: { + * is: ["[a-z]",'i'], // will only allow letters + * max: 23, // only allow values <= 23 + * isIn: { + * args: [['en', 'zh']], + * msg: "Must be English or Chinese" + * } + * }, + * field: 'column_a' + * // Other attributes here + * }, + * columnB: Sequelize.STRING, + * columnC: 'MY VERY OWN COLUMN TYPE' + * }) * * sequelize.models.modelName // The model will now be available in models under the name given to define * ``` @@ -4297,12 +4297,12 @@ declare module "sequelize" { * * ```js * sequelize.query('SELECT...').spread(function (results, metadata) { - * // Raw query - use spread - * }); + * // Raw query - use spread + * }); * * sequelize.query('SELECT...', { type: sequelize.QueryTypes.SELECT }).then(function (results) { - * // SELECT query - use then - * }) + * // SELECT query - use then + * }) * ``` * * @param sql @@ -4417,12 +4417,12 @@ declare module "sequelize" { * * ```js * sequelize.transaction().then(function (t) { - * return User.find(..., { transaction: t}).then(function (user) { - * return user.updateAttributes(..., { transaction: t}); - * }) - * .then(t.commit.bind(t)) - * .catch(t.rollback.bind(t)); - * }) + * return User.find(..., { transaction: t}).then(function (user) { + * return user.updateAttributes(..., { transaction: t}); + * }) + * .then(t.commit.bind(t)) + * .catch(t.rollback.bind(t)); + * }) * ``` * * A syntax for automatically committing or rolling back based on the promise chain resolution is also @@ -4430,15 +4430,15 @@ declare module "sequelize" { * * ```js * sequelize.transaction(function (t) { // Note that we use a callback rather than a promise.then() - * return User.find(..., { transaction: t}).then(function (user) { - * return user.updateAttributes(..., { transaction: t}); - * }); - * }).then(function () { - * // Commited - * }).catch(function (err) { - * // Rolled back - * console.error(err); - * }); + * return User.find(..., { transaction: t}).then(function (user) { + * return user.updateAttributes(..., { transaction: t}); + * }); + * }).then(function () { + * // Commited + * }).catch(function (err) { + * // Rolled back + * console.error(err); + * }); * ``` * * If you have [CLS](https://github.com/othiym23/node-continuation-local-storage) enabled, the transaction @@ -4555,27 +4555,27 @@ declare module "sequelize" { * * ```js * { - * READ_UNCOMMITTED: "READ UNCOMMITTED", - * READ_COMMITTED: "READ COMMITTED", - * REPEATABLE_READ: "REPEATABLE READ", - * SERIALIZABLE: "SERIALIZABLE" - * } + * READ_UNCOMMITTED: "READ UNCOMMITTED", + * READ_COMMITTED: "READ COMMITTED", + * REPEATABLE_READ: "REPEATABLE READ", + * SERIALIZABLE: "SERIALIZABLE" + * } * ``` * * Pass in the desired level as the first argument: * * ```js * return sequelize.transaction({ - * isolationLevel: Sequelize.Transaction.SERIALIZABLE - * }, function (t) { - * - * // your transactions - * - * }).then(function(result) { - * // transaction has been committed. Do something after the commit if required. - * }).catch(function(err) { - * // do something with the err. - * }); + * isolationLevel: Sequelize.Transaction.SERIALIZABLE + * }, function (t) { + * + * // your transactions + * + * }).then(function(result) { + * // transaction has been committed. Do something after the commit if required. + * }).catch(function(err) { + * // do something with the err. + * }); * ``` * * @see ISOLATION_LEVELS @@ -4597,23 +4597,23 @@ declare module "sequelize" { * ```js * t1 // is a transaction * Model.findAll({ - * where: ..., - * transaction: t1, - * lock: t1.LOCK... - * }); + * where: ..., + * transaction: t1, + * lock: t1.LOCK... + * }); * ``` * * Postgres also supports specific locks while eager loading by using OF: * ```js * UserModel.findAll({ - * where: ..., - * include: [TaskModel, ...], - * transaction: t1, - * lock: { - * level: t1.LOCK..., - * of: UserModel - * } - * }); + * where: ..., + * include: [TaskModel, ...], + * transaction: t1, + * lock: { + * level: t1.LOCK..., + * of: UserModel + * } + * }); * ``` * UserModel will be locked but TaskModel won't! */ From 745b182be1dc7fe33d460661dab6ab2cbda449e7 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Wed, 26 Aug 2015 14:40:47 +0900 Subject: [PATCH 019/167] modify type of refarences model --- sequelize/sequelize.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 0e84373a6..d14f9711c 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -3123,7 +3123,7 @@ declare module "sequelize" { /** * If this column references another table, provide it here as a Model, or a string */ - model?: Model; + model?: string | Model; /** * The column of the foreign table that this column references From 080810fc043c55222a44ab68fdc82c419057df6e Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Wed, 26 Aug 2015 14:41:24 +0900 Subject: [PATCH 020/167] modify return type of Instance methods --- sequelize/sequelize.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index d14f9711c..41e8410ae 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -1563,7 +1563,7 @@ declare module "sequelize" { * @param options.plain If set to true, included instances will be returned as plain objects */ get( key : string, options? : { plain? : boolean, clone? : boolean } ) : any; - get( options? : { plain? : boolean, clone? : boolean } ) : Object; + get( options? : { plain? : boolean, clone? : boolean } ) : TAttributes; /** * Set is used to update values on the instance (the sequelize representation of the instance that is, @@ -1716,7 +1716,7 @@ declare module "sequelize" { * Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all * values gotten from the DB, and apply all custom getters. */ - toJSON() : Object; + toJSON() : TAttributes; } From bb1b99052bf1d697f0368fbff56898bc1f5a525c Mon Sep 17 00:00:00 2001 From: Roman Salnikov Date: Wed, 26 Aug 2015 11:07:48 +0500 Subject: [PATCH 021/167] Add submit method definition to form-data This method is currently missing. Here is just a basic interface to pass type checks. If you'd help me figure out how to depend on Node TSD, I'd try to make signature more correct, and return http or https response instead of just `any`. Also planning to add `params` object interface. --- form-data/form-data.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/form-data/form-data.d.ts b/form-data/form-data.d.ts index 98dc1567d..2af4565cc 100644 --- a/form-data/form-data.d.ts +++ b/form-data/form-data.d.ts @@ -11,5 +11,6 @@ declare module "form-data" { getHeaders(): Object; // TODO expand pipe pipe(to: any): any; + submit(params: string|Object, callback: (error: any, response: any) => void): any; } } From 5037a214342644ce5425c74d41fd1721b2a07a08 Mon Sep 17 00:00:00 2001 From: Stefan Profanter Date: Wed, 26 Aug 2015 10:58:39 +0100 Subject: [PATCH 022/167] Fix #5499 Policies need to be static --- vortex-web-client/vortex-web-client-tests.ts | 4 +- vortex-web-client/vortex-web-client.d.ts | 69 ++++++++------------ 2 files changed, 28 insertions(+), 45 deletions(-) diff --git a/vortex-web-client/vortex-web-client-tests.ts b/vortex-web-client/vortex-web-client-tests.ts index 216e268c5..bf6f72bbc 100644 --- a/vortex-web-client/vortex-web-client-tests.ts +++ b/vortex-web-client/vortex-web-client-tests.ts @@ -7,7 +7,7 @@ var tqos = new dds.TopicQos(); var chatTopic = new dds.Topic(0, 'ChatMessage', tqos); runtime.registerTopic(chatTopic); -var writerQos = new dds.DataWriterQos(); +var writerQos = new dds.DataWriterQos(dds.Partition("chatroom"), dds.Reliability.Reliable, dds.Durability.Persistent); var writer = new dds.DataWriter(runtime, chatTopic, writerQos); writer.write({ @@ -15,7 +15,7 @@ writer.write({ msg : "Hello World!" }); -var readerQos = new dds.DataReaderQos(); +var readerQos = new dds.DataReaderQos(dds.Partition("chatroom"), dds.Reliability.Reliable, dds.Durability.Persistent); var reader = new dds.DataReader(runtime, chatTopic, readerQos); reader.addListener(function(msg) { diff --git a/vortex-web-client/vortex-web-client.d.ts b/vortex-web-client/vortex-web-client.d.ts index de665c780..b432eff3f 100644 --- a/vortex-web-client/vortex-web-client.d.ts +++ b/vortex-web-client/vortex-web-client.d.ts @@ -39,11 +39,11 @@ declare module DDS { /** * KeepAll - KEEP_ALL qos policy */ - KeepAll:any; + static KeepAll:any; /** * KeepLast - KEEP_LAST qos policy */ - KeepLast:any; + static KeepLast:any; } /** @@ -62,51 +62,37 @@ declare module DDS { /** * Reliable - 'Reliable' reliability policy */ - Reliable:any; + static Reliable:any; /** * BestEffort - 'BestEffort' reliability policy */ - BestEffort:any; + static BestEffort:any; } /** - * Partition policy + * Create new partition policy + * + * @param policies - partition names + * @example var qos = Partition('p1', 'p2') */ - export class Partition implements Policy { - /** - * Create new partition policy - * - * @param policies - partition names - * @example var qos = Partition('p1', 'p2') - */ - constructor(...policies:string[]); - } + export function Partition(...policies:string[]):Policy; /** - * Content Filter policy + * Create new content filter policy + * + * @param expr - filter expression + * @example var filter = ContentFilter("x>10 AND y<50") */ - export class ContentFilter implements Policy { - /** - * Create new content filter policy - * - * @param expr - filter expression - * @example var filter = ContentFilter("x>10 AND y<50") - */ - constructor(expr:string); - } + export function ContentFilter(expr:string):Policy; + /** - * Time Filter policy + * Create new time filter policy + * + * @param period - time duration (unit ?) + * @example var filter = TimeFilter(100) */ - export class TimeFilter implements Policy { - /** - * Create new content filter policy - * - * @param period - time duration (unit ?) - * @example var filter = TimeFilter(100) - */ - constructor(period:number); - } + export function TimeFilter(period:number):Policy; /** * Durability Policy @@ -125,19 +111,19 @@ declare module DDS { /** * Volatile - Volatile durability policy */ - Volatile:any; + static Volatile:any; /** * TransientLocal - TransientLocal durability policy */ - TransientLocal:any; + static TransientLocal:any; /** * Transient - Transient durability policy */ - Transient:any; + static Transient:any; /** * Persistent - Persistent durability policy */ - Persistent:any; + static Persistent:any; } @@ -473,7 +459,7 @@ declare module DDS { export var runtime:{ Runtime : Runtime; - } + }; export var VERSION:string; } @@ -482,7 +468,4 @@ declare module DDS { * Defines the core Vortex-Web-Client javascript library. It includes the JavaScript API for DDS. This API allows * web applications to share data among them as well as with native DDS applications. */ -declare -var dds:typeof DDS; - - +declare var dds:typeof DDS; From df00f78b09f81a87ed45204df6e53aa9dbe6d073 Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Wed, 26 Aug 2015 14:19:08 +0100 Subject: [PATCH 023/167] Add Offline definitions Fixes #5556. --- offline-js/offline-js-tests.ts | 40 ++++++++++++++++++++++ offline-js/offline-js.d.ts | 62 ++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 offline-js/offline-js-tests.ts create mode 100644 offline-js/offline-js.d.ts diff --git a/offline-js/offline-js-tests.ts b/offline-js/offline-js-tests.ts new file mode 100644 index 000000000..82af46683 --- /dev/null +++ b/offline-js/offline-js-tests.ts @@ -0,0 +1,40 @@ +// Test file for offline-js. +/// + +Offline.options = { + checkOnLoad: false, + interceptRequests: true, + checks: { + xhr: { url: '/connection-test' }, + image: { url: 'my-image.gif' }, + active: 'image' + }, + reconnect: { + initialDelay: 3, + delay: 60 + }, + requests: true, + game: false +}; + +Offline.check(); + +Offline.state; + +var handler = () => {}, + context = {}; + +Offline.on("up", handler, context); +Offline.on("down", handler, context); +Offline.on("confirmed-up", handler, context); +Offline.on("confirmed-down", handler, context); +Offline.on("checking", handler, context); +Offline.on("reconnect:started", handler, context); +Offline.on("reconnect:stopped", handler, context); +Offline.on("reconnect:tick", handler, context); +Offline.on("reconnect:connecting", handler, context); +Offline.on("reconnect:failure", handler, context); +Offline.on("requests:flush", handler, context); +Offline.on("requests:hold", handler, context); + +Offline.off("up", handler); \ No newline at end of file diff --git a/offline-js/offline-js.d.ts b/offline-js/offline-js.d.ts new file mode 100644 index 000000000..1f8dd63d7 --- /dev/null +++ b/offline-js/offline-js.d.ts @@ -0,0 +1,62 @@ +// Type definitions for Offline 0.7.14 +// Project: https://github.com/HubSpot/offline +// Definitions by: Chris Wrench +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var Offline: { + options: OfflineOptions; + check: () => void; + state: string; + on(event: string, handler: (e: Event) => any, context?: any): void; + on(event: "up", handler: (e: Event) => any, context?: any): void; + on(event: "down", handler: (e: Event) => any, context?: any): void; + on(event: "confirmed-up", handler: (e: Event) => any, context?: any): void; + on(event: "confirmed-down", handler: (e: Event) => any, context?: any): void; + on(event: "checking", handler: (e: Event) => any, context?: any): void; + on(event: "reconnect:started", handler: (e: Event) => any, context?: any): void; + on(event: "reconnect:stopped", handler: (e: Event) => any, context?: any): void; + on(event: "reconnect:tick", handler: (e: Event) => any, context?: any): void; + on(event: "reconnect:connecting", handler: (e: Event) => any, context?: any): void; + on(event: "reconnect:failure", handler: (e: Event) => any, context?: any): void; + on(event: "requests:flush", handler: (e: Event) => any, context?: any): void; + on(event: "requests:hold", handler: (e: Event) => any, context?: any): void; + off(event: string, handler?: (e: Event) => any): void; + off(event: "up", handler?: (e: Event) => any): void; + off(event: "down", handler?: (e: Event) => any): void; + off(event: "confirmed-up", handler?: (e: Event) => any): void; + off(event: "confirmed-down", handler?: (e: Event) => any): void; + off(event: "checking", handler?: (e: Event) => any): void; + off(event: "reconnect:started", handler?: (e: Event) => any): void; + off(event: "reconnect:stopped", handler?: (e: Event) => any): void; + off(event: "reconnect:tick", handler?: (e: Event) => any): void; + off(event: "reconnect:connecting", handler?: (e: Event) => any): void; + off(event: "reconnect:failure", handler?: (e: Event) => any): void; + off(event: "requests:flush", handler?: (e: Event) => any): void; + off(event: "requests:hold", handler?: (e: Event) => any): void; +}; + +interface OfflineOptions { + // TODO Should these types be `boolean|Function`? + // The project documentation is not clear here. + checkOnLoad?: boolean; + interceptRequests?: boolean; + requests?: boolean; + game?: boolean; + checks?: OfflineChecks; + reconnect: { + initialDelay: number; + delay: number; + }; +} + +interface OfflineChecks { + // TODO "xhr" and "image" probably have different options. + // However, this is not stated in the project documentation. + xhr?: OfflineCheck; + image?: OfflineCheck; + active?: string; +} + +interface OfflineCheck { + url: string; +} From 3159d3f697522e0d95f50a1b88d77600a4f5559b Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Wed, 26 Aug 2015 20:53:19 +0100 Subject: [PATCH 024/167] Fix offline-js formatting --- offline-js/offline-js.d.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/offline-js/offline-js.d.ts b/offline-js/offline-js.d.ts index 1f8dd63d7..f52b47e0c 100644 --- a/offline-js/offline-js.d.ts +++ b/offline-js/offline-js.d.ts @@ -6,8 +6,8 @@ declare var Offline: { options: OfflineOptions; check: () => void; - state: string; - on(event: string, handler: (e: Event) => any, context?: any): void; + state: string; + on(event: "up", handler: (e: Event) => any, context?: any): void; on(event: "down", handler: (e: Event) => any, context?: any): void; on(event: "confirmed-up", handler: (e: Event) => any, context?: any): void; @@ -20,7 +20,8 @@ declare var Offline: { on(event: "reconnect:failure", handler: (e: Event) => any, context?: any): void; on(event: "requests:flush", handler: (e: Event) => any, context?: any): void; on(event: "requests:hold", handler: (e: Event) => any, context?: any): void; - off(event: string, handler?: (e: Event) => any): void; + on(event: string, handler: (e: Event) => any, context?: any): void; + off(event: "up", handler?: (e: Event) => any): void; off(event: "down", handler?: (e: Event) => any): void; off(event: "confirmed-up", handler?: (e: Event) => any): void; @@ -32,11 +33,12 @@ declare var Offline: { off(event: "reconnect:connecting", handler?: (e: Event) => any): void; off(event: "reconnect:failure", handler?: (e: Event) => any): void; off(event: "requests:flush", handler?: (e: Event) => any): void; - off(event: "requests:hold", handler?: (e: Event) => any): void; + off(event: "requests:hold", handler?: (e: Event) => any): void; + off(event: string, handler?: (e: Event) => any): void; }; interface OfflineOptions { - // TODO Should these types be `boolean|Function`? + // TODO Should these types be `boolean|Function`? // The project documentation is not clear here. checkOnLoad?: boolean; interceptRequests?: boolean; @@ -50,8 +52,8 @@ interface OfflineOptions { } interface OfflineChecks { - // TODO "xhr" and "image" probably have different options. - // However, this is not stated in the project documentation. + // TODO "xhr" and "image" probably have different options. + // However, this is not stated in the project documentation. xhr?: OfflineCheck; image?: OfflineCheck; active?: string; From ab7877b6622c655e9b2e6b07b442d244a5ef643f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20Hawkins=20=E2=80=94=20=28=CC=90=CC=85=CC=96=CC=A3?= =?UTF-8?q?=CD=95=CC=A0=CC=AC=CC=AD=CC=9E=CC=AAi=CC=89=CD=AE=CC=AD=CC=A3?= =?UTF-8?q?=CD=88=CC=AA=CC=A0s=CD=91=CD=8C=CD=8B=CD=AA=CC=83=CC=8D=CC=B3?= =?UTF-8?q?=CC=B3=CC=A6=CC=9E=CC=B0=CC=9C=CC=9E=CC=B3=20=CC=81=CD=91=CD=A8?= =?UTF-8?q?=CD=84=CC=8E=CC=8B=CD=AE=CD=8A=CC=80=CC=A9=CC=98n=CC=83=CC=88?= =?UTF-8?q?=CD=AE=CD=A6=CC=81=CD=AB=CD=90=CD=9B=CD=94=CC=A3=CD=85=CD=85?= =?UTF-8?q?=CD=93=CC=ACo=CC=90=CD=86=CC=BD=CC=A9=CC=A6=CC=B3=CC=A0=CC=99?= =?UTF-8?q?=CC=97=CC=AF=CC=BAt=CD=82=CD=A9=CD=8B=CC=85=CD=84=CC=9C=CC=A5?= =?UTF-8?q?=CC=BB=CC=99=CC=9F=CC=BC=CC=9C=20=CD=92=CD=8B=CC=85=CC=81=CD=90?= =?UTF-8?q?=CC=A0=CC=A6=CC=B9=CC=9F=CD=95=CD=95=CC=B1=CD=89a=CC=84=CD=A6?= =?UTF-8?q?=CC=92=CC=8D=CD=8B=CC=9F=CC=BB=CC=B1=20=CD=A8=CD=A9=CD=8A=CD=82?= =?UTF-8?q?=CC=89=CD=85=CC=97=CC=9E=CD=9Ah=CD=A3=CD=94=CC=BC=CD=9A=CC=A9?= =?UTF-8?q?=CD=9A=CC=AA=CC=9D=CC=9Da=CC=92=CC=93=CD=AC=CC=AB=CC=ABc=CC=83?= =?UTF-8?q?=CD=A5=CD=AF=CC=A6=CC=B2=CC=B3=CD=8D=CC=B9k=CC=8A=CC=B2=CD=95?= =?UTF-8?q?=CC=97=CC=96=CC=A4=CC=99=CC=9C=CD=8De=CC=BF=CC=AB=CD=8E=CC=9F?= =?UTF-8?q?=CC=BC=CC=BA=CC=ABr=CC=8A=CC=91=CC=BF=CC=85=CD=AF=CD=99=CD=85?= =?UTF-8?q?=CC=B0=29=CD=86=CC=87=CD=A7=CC=9A=CD=91=CC=AA=CC=96=CD=87=CC=9D?= =?UTF-8?q?=CC=AE=CC=AA=CD=96=CC=A6?= Date: Wed, 26 Aug 2015 16:38:26 -0400 Subject: [PATCH 025/167] Update to fix AMD/UMD module imports --- stripe/stripe.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index ca589e133..7771b092b 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -1,6 +1,6 @@ -// Type definitions for stripe +// Type definitions for stripe (AMD/UMD compatible) // Project: https://stripe.com/ -// Definitions by: Eric J. Smith +// Definitions by: Andy Hawkins , Eric J. Smith // Definitions: https://github.com/borisyankov/DefinitelyTyped interface StripeStatic { @@ -11,6 +11,7 @@ interface StripeStatic { cardType(cardNumber: string): string; getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void; card: StripeCardData; + createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void; } interface StripeTokenData { @@ -57,8 +58,9 @@ interface StripeCardData { address_state?: string; address_zip?: string; address_country?: string; - - createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void; } declare var Stripe: StripeStatic; +declare module "Stripe" { + export = StripeStatic; +} From c4a713cfeecbb7e26fed4984611bbb35054867ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20Hawkins=20=E2=80=94=20=28=CC=90=CC=85=CC=96=CC=A3?= =?UTF-8?q?=CD=95=CC=A0=CC=AC=CC=AD=CC=9E=CC=AAi=CC=89=CD=AE=CC=AD=CC=A3?= =?UTF-8?q?=CD=88=CC=AA=CC=A0s=CD=91=CD=8C=CD=8B=CD=AA=CC=83=CC=8D=CC=B3?= =?UTF-8?q?=CC=B3=CC=A6=CC=9E=CC=B0=CC=9C=CC=9E=CC=B3=20=CC=81=CD=91=CD=A8?= =?UTF-8?q?=CD=84=CC=8E=CC=8B=CD=AE=CD=8A=CC=80=CC=A9=CC=98n=CC=83=CC=88?= =?UTF-8?q?=CD=AE=CD=A6=CC=81=CD=AB=CD=90=CD=9B=CD=94=CC=A3=CD=85=CD=85?= =?UTF-8?q?=CD=93=CC=ACo=CC=90=CD=86=CC=BD=CC=A9=CC=A6=CC=B3=CC=A0=CC=99?= =?UTF-8?q?=CC=97=CC=AF=CC=BAt=CD=82=CD=A9=CD=8B=CC=85=CD=84=CC=9C=CC=A5?= =?UTF-8?q?=CC=BB=CC=99=CC=9F=CC=BC=CC=9C=20=CD=92=CD=8B=CC=85=CC=81=CD=90?= =?UTF-8?q?=CC=A0=CC=A6=CC=B9=CC=9F=CD=95=CD=95=CC=B1=CD=89a=CC=84=CD=A6?= =?UTF-8?q?=CC=92=CC=8D=CD=8B=CC=9F=CC=BB=CC=B1=20=CD=A8=CD=A9=CD=8A=CD=82?= =?UTF-8?q?=CC=89=CD=85=CC=97=CC=9E=CD=9Ah=CD=A3=CD=94=CC=BC=CD=9A=CC=A9?= =?UTF-8?q?=CD=9A=CC=AA=CC=9D=CC=9Da=CC=92=CC=93=CD=AC=CC=AB=CC=ABc=CC=83?= =?UTF-8?q?=CD=A5=CD=AF=CC=A6=CC=B2=CC=B3=CD=8D=CC=B9k=CC=8A=CC=B2=CD=95?= =?UTF-8?q?=CC=97=CC=96=CC=A4=CC=99=CC=9C=CD=8De=CC=BF=CC=AB=CD=8E=CC=9F?= =?UTF-8?q?=CC=BC=CC=BA=CC=ABr=CC=8A=CC=91=CC=BF=CC=85=CD=AF=CD=99=CD=85?= =?UTF-8?q?=CC=B0=29=CD=86=CC=87=CD=A7=CC=9A=CD=91=CC=AA=CC=96=CD=87=CC=9D?= =?UTF-8?q?=CC=AE=CC=AA=CD=96=CC=A6?= Date: Wed, 26 Aug 2015 16:41:20 -0400 Subject: [PATCH 026/167] fix header --- stripe/stripe.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 7771b092b..96d8758bc 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -1,4 +1,4 @@ -// Type definitions for stripe (AMD/UMD compatible) +// Type definitions for stripe // Project: https://stripe.com/ // Definitions by: Andy Hawkins , Eric J. Smith // Definitions: https://github.com/borisyankov/DefinitelyTyped From 5c69bdeb4541a496f65171559a5de025e6a126b3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 15:26:57 -0700 Subject: [PATCH 027/167] Add indexer to option constructors in 'winston'. --- winston/winston.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/winston/winston.d.ts b/winston/winston.d.ts index 954e3358b..c816a533a 100644 --- a/winston/winston.d.ts +++ b/winston/winston.d.ts @@ -98,6 +98,11 @@ declare module "winston" { * @type {(boolean|(err: Error) => void)} */ exitOnError?: any; + + // TODO: Need to make instances specific, + // and need to get options for each instance. + // Unfortunately, the documentation is unhelpful. + [optionName: string]: any; } export interface TransportStatic { @@ -141,6 +146,11 @@ declare module "winston" { raw?: boolean; name?: string; handleExceptions?: boolean; + + // TODO: Need to make instances specific, + // and need to get options for each instance. + // Unfortunately, the documentation is unhelpful. + [optionName: string]: any; } export interface QueryOptions { From 8b244197ae005a85f5fe10338676e51e70a45a42 Mon Sep 17 00:00:00 2001 From: Sam Saint-Pettersen Date: Thu, 27 Aug 2015 01:20:05 +0100 Subject: [PATCH 028/167] Create jquery-urlparam.d.ts --- jquery-urlparam/jquery-urlparam.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 jquery-urlparam/jquery-urlparam.d.ts diff --git a/jquery-urlparam/jquery-urlparam.d.ts b/jquery-urlparam/jquery-urlparam.d.ts new file mode 100644 index 000000000..497f9fda5 --- /dev/null +++ b/jquery-urlparam/jquery-urlparam.d.ts @@ -0,0 +1,8 @@ +// Type definitions for jquery-urlparam +// Project: https://gist.github.com/stpettersens/e1f4478f299b6f4905c1 +// Definitions by: Sam Saint-Pettersen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface JQueryStatic { + urlParam(variable: string): string; +} From 65d6b9b507bdcfdf814cdb183a1922e93f547b81 Mon Sep 17 00:00:00 2001 From: Sam Saint-Pettersen Date: Thu, 27 Aug 2015 01:21:08 +0100 Subject: [PATCH 029/167] Create jquery-urlparam-tests.ts --- jquery-urlparam/jquery-urlparam-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 jquery-urlparam/jquery-urlparam-tests.ts diff --git a/jquery-urlparam/jquery-urlparam-tests.ts b/jquery-urlparam/jquery-urlparam-tests.ts new file mode 100644 index 000000000..5ad4d26d5 --- /dev/null +++ b/jquery-urlparam/jquery-urlparam-tests.ts @@ -0,0 +1,4 @@ +/// +/// + +console.log($.urlParam('variable')); From 6ffcb6a8d6cab7413e60ed8390a7654dae996a0e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 17:33:49 -0700 Subject: [PATCH 030/167] Use 'namespace' keyword in 'vexflow'. --- vexflow/vexflow.d.ts | 68 ++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/vexflow/vexflow.d.ts b/vexflow/vexflow.d.ts index 1822c0c67..bba0c6a44 100644 --- a/vexflow/vexflow.d.ts +++ b/vexflow/vexflow.d.ts @@ -6,7 +6,7 @@ //inconsistent namespace: this is a helper funtion from tables.js and should not pollute the global namespace! declare function sanitizeDuration(duration : string) : string; -declare module Vex { +declare namespace Vex { function L(block : string, args : any[]) : void; function Merge(destination : T, source : Object) : T; @@ -90,7 +90,7 @@ declare module Vex { original_font_information? : {postscript_name : string, version_string : string, vendor_url : string, full_font_name : string, font_family_name : string, copyright : string, description : string, trademark : string, designer : string, designer_url : string, unique_font_identifier : string, license_url : string, license_description : string, manufacturer_name : string, font_sub_family_name : string}; } - module Flow { + namespace Flow { const RESOLUTION : number; @@ -137,7 +137,7 @@ declare module Vex { original_font_information : {postscript_name : string, version_string : string, vendor_url : string, full_font_name : string, font_family_name : string, copyright : string, description : string, trademark : string, designer : string, designer_url : string, unique_font_identifier : string, license_url : string, license_description : string, manufacturer_name : string, font_sub_family_name : string}; } - module Accidental { + namespace Accidental { const CATEGORY : string; } @@ -154,7 +154,7 @@ declare module Vex { static applyAccidentals(voices : Voice[], keySignature? : string) : void; } - export module Annotation { + namespace Annotation { const enum Justify {LEFT, CENTER, RIGHT, CENTER_STEM} const enum VerticalJustify {TOP, CENTER, BOTTOM, CENTER_STEM} const CATEGORY : string; @@ -172,7 +172,7 @@ declare module Vex { draw() : void; } - module Articulation { + namespace Articulation { const CATEGORY : string; } @@ -193,7 +193,7 @@ declare module Vex { draw() : void; } - export module Barline { + namespace Barline { const enum type {SINGLE, DOUBLE, END, REPEAT_BEGIN, REPEAT_END, REPEAT_BOTH, NONE} } @@ -228,7 +228,7 @@ declare module Vex { static generateBeams(notes : StemmableNote[], config? : {groups? : Fraction[], stem_direction? : number, beam_rests? : boolean, beam_middle_only? : boolean, show_stemlets? : boolean, maintain_stem_directions? : boolean}) : Beam[]; } - module Bend { + namespace Bend { const CATEGORY : string; } @@ -354,7 +354,7 @@ declare module Vex { draw() : void; } - export module Curve { + namespace Curve { const enum Position {NEAR_HEAD, NEAR_TOP} } @@ -368,7 +368,7 @@ declare module Vex { draw() : boolean; } - module Dot { + namespace Dot { const CATEGORY : string; } @@ -433,7 +433,7 @@ declare module Vex { parse(str : string) : Fraction; } - module FretHandFinger { + namespace FretHandFinger { const CATEGORY : string; } @@ -489,7 +489,7 @@ declare module Vex { draw() : void; } - module GraceNoteGroup { + namespace GraceNoteGroup { const CATEGORY : string; } @@ -531,7 +531,7 @@ declare module Vex { convertAccLines(clef : string, type : string) : void; } - export module Modifier { + namespace Modifier { const enum Position {LEFT, RIGHT, ABOVE, BELOW} const CATEGORY : string } @@ -570,7 +570,7 @@ declare module Vex { postFormat() : void; } - module Music { + namespace Music { const NUM_TONES : number; const roots : string[]; const root_values : number[]; @@ -600,7 +600,7 @@ declare module Vex { createScaleMap(keySignature : string) : {[rootName : string] : string}; } - module Note { + namespace Note { const CATEGORY : string; } @@ -687,7 +687,7 @@ declare module Vex { draw() : void; } - module Ornament { + namespace Ornament { const CATEGORY : string; } @@ -701,7 +701,7 @@ declare module Vex { draw() : void; } - export module PedalMarking { + namespace PedalMarking { const enum Styles {TEXT, BRACKET, MIXED} const GLYPHS : {[name : string] : {code : string, x_shift : number, y_shift : number}}; } @@ -760,7 +760,7 @@ declare module Vex { restore() : RaphaelContext; } - export module Renderer { + namespace Renderer { const enum Backends {CANVAS, RAPHAEL, SVG, VML} const enum LineEndType {NONE, UP, DOWN} } @@ -778,7 +778,7 @@ declare module Vex { getContext() : IRenderContext; } - export module Repetition { + namespace Repetition { const enum type {NONE, CODA_LEFT, CODA_RIGHT, SEGNO_LEFT, SEGNO_RIGHT, DC, DC_AL_CODA, DC_AL_FINE, DS, DS_AL_CODA, DS_AL_FINE, FINE} } @@ -847,7 +847,7 @@ declare module Vex { setConfigForLines(lines_configuration : {visible : boolean}[]) : Stave; } - export module StaveConnector { + namespace StaveConnector { const enum type {SINGLE_RIGHT, SINGLE_LEFT, SINGLE, DOUBLE, BRACE, BRACKET, BOLD_DOUBLE_LEFT, BOLD_DOUBLE_RIGHT, THIN_DOUBLE} } @@ -862,7 +862,7 @@ declare module Vex { drawBoldDoubleLine(ctx : Object, type : StaveConnector.type, topX : number, topY : number, botY : number) : void; } - export module StaveHairpin { + namespace StaveHairpin { const enum type {CRESC, DECRESC} } @@ -877,7 +877,7 @@ declare module Vex { draw() : boolean; } - export module StaveLine { + namespace StaveLine { const enum TextVerticalPosition {TOP, BOTTOM} const enum TextJustification {LEFT, CENTER, RIGHT} } @@ -907,7 +907,7 @@ declare module Vex { addEndModifier() : void; } - module StaveNote { + namespace StaveNote { const STEM_UP : number; const STEM_DOWN : number; const CATEGORY : string; @@ -1019,7 +1019,7 @@ declare module Vex { draw() : boolean; } - module Stem { + namespace Stem { const UP : number; const DOWN : number; } @@ -1071,7 +1071,7 @@ declare module Vex { drawStem(stem_struct : {x_begin? : number, x_end? : number, y_top? : number, y_bottom? : number, y_extend? : number, stem_extension? : number, stem_direction? : number}) : void; } - module StringNumber { + namespace StringNumber { const CATEGORY : string; } @@ -1096,7 +1096,7 @@ declare module Vex { draw() : void; } - export module Stroke { + namespace Stroke { const enum Type {BRUSH_DOWN, BRUSH_UP, ROLL_DOWN, ROLL_UP, RASQUEDO_DOWN, RASQUEDO_UP} const CATEGORY : string; } @@ -1175,7 +1175,7 @@ declare module Vex { draw() : void; } - module TabSlide { + namespace TabSlide { const SLIDE_UP : number; const SLIDE_DOWN : number; } @@ -1200,7 +1200,7 @@ declare module Vex { draw() : boolean; } - export module TextBracket { + namespace TextBracket { const enum Positions {TOP, BOTTOM} } @@ -1223,7 +1223,7 @@ declare module Vex { draw() : void; } - export module TextNote { + namespace TextNote { const enum Justification {LEFT, CENTER, RIGHT} const GLYPHS : {[name : string] : {code : string, point : number, x_shift : number, y_shift : number}} } @@ -1286,7 +1286,7 @@ declare module Vex { static getNextContext(tContext : TickContext) : TickContext; } - module TimeSignature { + namespace TimeSignature { const glyphs : {[name : string] : {code : string, point : number, line : number}}; } @@ -1321,7 +1321,7 @@ declare module Vex { draw() : void; } - module Tuning { + namespace Tuning { const names : {[name : string] : string}; } @@ -1334,7 +1334,7 @@ declare module Vex { getNoteForFret(fretNum : string, stringNum : string) : string; } - module Tuplet { + namespace Tuplet { const LOCATION_TOP : number; const LOCATION_BOTTOM : number; } @@ -1355,7 +1355,7 @@ declare module Vex { draw() : void; } - module Vibrato { + namespace Vibrato { const CATEGORY : string; } @@ -1366,7 +1366,7 @@ declare module Vex { draw() : void; } - export module Voice { + namespace Voice { const enum Mode {STRICT, SOFT, FULL} } @@ -1399,7 +1399,7 @@ declare module Vex { addVoice(voice : Voice) : void; } - export module Volta { + namespace Volta { const enum type {NONE, BEGIN, MID, END, BEGIN_END} } From f4b5bc37e4fd4cba6ae393f04b8b079fe1a024eb Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 17:47:21 -0700 Subject: [PATCH 031/167] Fixed ordering of namespaces/classes to avoid errors from https://github.com/Microsoft/TypeScript/issues/4485 in 'vexflow'. --- vexflow/vexflow.d.ts | 250 +++++++++++++++++++++---------------------- 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/vexflow/vexflow.d.ts b/vexflow/vexflow.d.ts index bba0c6a44..c17e96576 100644 --- a/vexflow/vexflow.d.ts +++ b/vexflow/vexflow.d.ts @@ -137,10 +137,6 @@ declare namespace Vex { original_font_information : {postscript_name : string, version_string : string, vendor_url : string, full_font_name : string, font_family_name : string, copyright : string, description : string, trademark : string, designer : string, designer_url : string, unique_font_identifier : string, license_url : string, license_description : string, manufacturer_name : string, font_sub_family_name : string}; } - namespace Accidental { - const CATEGORY : string; - } - class Accidental extends Modifier { //TODO remove the following lines once TypeScript allows subclass overrides with type changes setNote(note : Note) : Modifier; @@ -154,9 +150,7 @@ declare namespace Vex { static applyAccidentals(voices : Voice[], keySignature? : string) : void; } - namespace Annotation { - const enum Justify {LEFT, CENTER, RIGHT, CENTER_STEM} - const enum VerticalJustify {TOP, CENTER, BOTTOM, CENTER_STEM} + namespace Accidental { const CATEGORY : string; } @@ -172,7 +166,9 @@ declare namespace Vex { draw() : void; } - namespace Articulation { + namespace Annotation { + const enum Justify {LEFT, CENTER, RIGHT, CENTER_STEM} + const enum VerticalJustify {TOP, CENTER, BOTTOM, CENTER_STEM} const CATEGORY : string; } @@ -183,6 +179,10 @@ declare namespace Vex { draw() : void; } + namespace Articulation { + const CATEGORY : string; + } + class BarNote extends Note { static DEBUG : boolean; getType() : Barline.type; @@ -228,10 +228,6 @@ declare namespace Vex { static generateBeams(notes : StemmableNote[], config? : {groups? : Fraction[], stem_direction? : number, beam_rests? : boolean, beam_middle_only? : boolean, show_stemlets? : boolean, maintain_stem_directions? : boolean}) : Beam[]; } - namespace Bend { - const CATEGORY : string; - } - class Bend extends Modifier { constructor(text : string, release? : boolean, phrase? : {type : number, text : string, width : number}[]); static UP : number; @@ -244,6 +240,10 @@ declare namespace Vex { draw() : void; } + namespace Bend { + const CATEGORY : string; + } + class BoundingBox { constructor(x : number, y : number, w : number, h : number); static copy(that : BoundingBox) : BoundingBox; @@ -354,10 +354,6 @@ declare namespace Vex { draw() : void; } - namespace Curve { - const enum Position {NEAR_HEAD, NEAR_TOP} - } - class Curve { constructor(from : Note, to : Note, options? : {spacing? : number, thickness? : number, x_shift? : number, y_shift : number, position : Curve.Position, invert : boolean, cps? : {x : number, y : number}[]}); static DEBUG : boolean; @@ -368,8 +364,8 @@ declare namespace Vex { draw() : boolean; } - namespace Dot { - const CATEGORY : string; + namespace Curve { + const enum Position {NEAR_HEAD, NEAR_TOP} } class Dot extends Modifier { @@ -382,6 +378,10 @@ declare namespace Vex { draw() : void; } + namespace Dot { + const CATEGORY : string; + } + class Formatter { static DEBUG : boolean; static FormatAndDraw(ctx : IRenderContext, stave : Stave, notes : Note[], params? : {auto_beam : boolean, align_rests : boolean}) : BoundingBox; @@ -433,10 +433,6 @@ declare namespace Vex { parse(str : string) : Fraction; } - namespace FretHandFinger { - const CATEGORY : string; - } - class FretHandFinger extends Modifier { constructor(number : number); static format(nums : FretHandFinger[], state : {left_shift : number, right_shift : number, text_line : number}) : void; @@ -452,6 +448,10 @@ declare namespace Vex { draw() : void; } + namespace FretHandFinger { + const CATEGORY : string; + } + class GhostNote extends StemmableNote { //TODO remove the following lines once TypeScript allows subclass overrides with type changes or type inconsistencies mentioned below are fixed setStave(stave : Stave) : Note; @@ -489,10 +489,6 @@ declare namespace Vex { draw() : void; } - namespace GraceNoteGroup { - const CATEGORY : string; - } - class GraceNoteGroup extends Modifier { //TODO remove the following lines once TypeScript allows subclass overrides with type changes or type inconsistencies mentioned below are fixed setWidth(width : number) : Modifier; @@ -510,6 +506,10 @@ declare namespace Vex { draw() : void; } + namespace GraceNoteGroup { + const CATEGORY : string; + } + class KeyManager { constructor(key : string); setKey(key : string) : KeyManager; @@ -531,11 +531,6 @@ declare namespace Vex { convertAccLines(clef : string, type : string) : void; } - namespace Modifier { - const enum Position {LEFT, RIGHT, ABOVE, BELOW} - const CATEGORY : string - } - class Modifier { static DEBUG : boolean; getCategory() : string; @@ -557,6 +552,11 @@ declare namespace Vex { draw() : void; } + namespace Modifier { + const enum Position {LEFT, RIGHT, ABOVE, BELOW} + const CATEGORY : string + } + class ModifierContext { static DEBUG : boolean; addModifier(modifier : Modifier) : ModifierContext; @@ -570,20 +570,6 @@ declare namespace Vex { postFormat() : void; } - namespace Music { - const NUM_TONES : number; - const roots : string[]; - const root_values : number[]; - const root_indices : {[root : string] : number}; - const canonical_notes : string[]; - const diatonic_intervals : string[]; - const diatonic_accidentals : {[diatonic_interval : string] : {note : number, accidental : number}}; - const intervals : {[interval : string] : number}; - const scales : {[scale : string] : number[]}; - const accidentals : string[]; - const noteValues : {[value : string] : {root_index : number, int_val : number}}; - } - class Music { isValidNoteValue(note : number) : boolean; isValidIntervalValue(interval : number) : boolean; @@ -600,8 +586,18 @@ declare namespace Vex { createScaleMap(keySignature : string) : {[rootName : string] : string}; } - namespace Note { - const CATEGORY : string; + namespace Music { + const NUM_TONES : number; + const roots : string[]; + const root_values : number[]; + const root_indices : {[root : string] : number}; + const canonical_notes : string[]; + const diatonic_intervals : string[]; + const diatonic_accidentals : {[diatonic_interval : string] : {note : number, accidental : number}}; + const intervals : {[interval : string] : number}; + const scales : {[scale : string] : number[]}; + const accidentals : string[]; + const noteValues : {[value : string] : {root_index : number, int_val : number}}; } class Note implements Tickable { @@ -664,6 +660,10 @@ declare namespace Vex { setPreFormatted(value : boolean) : void; } + namespace Note { + const CATEGORY : string; + } + class NoteHead extends Note { constructor(head_options : {x? : number, y? : number, note_type? : string, duration : string, displaced? : boolean, stem_direction? : number, line : number, x_shift : number, custom_glyph_code? : string, style? : string, slashed? : boolean, glyph_font_scale? : number}); static DEBUG : boolean; @@ -687,10 +687,6 @@ declare namespace Vex { draw() : void; } - namespace Ornament { - const CATEGORY : string; - } - class Ornament extends Modifier { constructor(type : string); static DEBUG : boolean; @@ -701,9 +697,8 @@ declare namespace Vex { draw() : void; } - namespace PedalMarking { - const enum Styles {TEXT, BRACKET, MIXED} - const GLYPHS : {[name : string] : {code : string, x_shift : number, y_shift : number}}; + namespace Ornament { + const CATEGORY : string; } class PedalMarking { @@ -721,6 +716,11 @@ declare namespace Vex { draw() : void; } + namespace PedalMarking { + const enum Styles {TEXT, BRACKET, MIXED} + const GLYPHS : {[name : string] : {code : string, x_shift : number, y_shift : number}}; + } + class RaphaelContext implements IRenderContext { //TODO remove the following lines once TypeScript allows subclass overrides with type changes or type inconsistencies mentioned below are fixed setLineWidth(width : number) : RaphaelContext; @@ -760,11 +760,6 @@ declare namespace Vex { restore() : RaphaelContext; } - namespace Renderer { - const enum Backends {CANVAS, RAPHAEL, SVG, VML} - const enum LineEndType {NONE, UP, DOWN} - } - class Renderer { constructor(sel : HTMLElement, backend : Renderer.Backends) static USE_CANVAS_PROXY : boolean; @@ -778,8 +773,9 @@ declare namespace Vex { getContext() : IRenderContext; } - namespace Repetition { - const enum type {NONE, CODA_LEFT, CODA_RIGHT, SEGNO_LEFT, SEGNO_RIGHT, DC, DC_AL_CODA, DC_AL_FINE, DS, DS_AL_CODA, DS_AL_FINE, FINE} + namespace Renderer { + const enum Backends {CANVAS, RAPHAEL, SVG, VML} + const enum LineEndType {NONE, UP, DOWN} } class Repetition extends StaveModifier { @@ -792,6 +788,10 @@ declare namespace Vex { drawSignoFixed(stave : Stave, x : number) : Repetition; //inconsistent name: drawSignoFixed -> drawSegnoFixed drawSymbolText(stave : Stave, x : number, text : string, draw_coda : boolean) : Repetition; } + + namespace Repetition { + const enum type { NONE, CODA_LEFT, CODA_RIGHT, SEGNO_LEFT, SEGNO_RIGHT, DC, DC_AL_CODA, DC_AL_FINE, DS, DS_AL_CODA, DS_AL_FINE, FINE } + } class Stave { constructor(x : number, y : number, width : number, options? : {vertical_bar_width? : number, glyph_spacing_px? : number, num_lines? : number, fill_style? : string, spacing_between_lines_px? : number, space_above_staff_ln? : number, space_below_staff_ln? : number, top_text_position? : number}); @@ -847,10 +847,6 @@ declare namespace Vex { setConfigForLines(lines_configuration : {visible : boolean}[]) : Stave; } - namespace StaveConnector { - const enum type {SINGLE_RIGHT, SINGLE_LEFT, SINGLE, DOUBLE, BRACE, BRACKET, BOLD_DOUBLE_LEFT, BOLD_DOUBLE_RIGHT, THIN_DOUBLE} - } - class StaveConnector { constructor(top_stave : Stave, bottom_stave : Stave); setContext(ctx : IRenderContext) : StaveConnector; @@ -861,9 +857,9 @@ declare namespace Vex { draw() : void; drawBoldDoubleLine(ctx : Object, type : StaveConnector.type, topX : number, topY : number, botY : number) : void; } - - namespace StaveHairpin { - const enum type {CRESC, DECRESC} + + namespace StaveConnector { + const enum type { SINGLE_RIGHT, SINGLE_LEFT, SINGLE, DOUBLE, BRACE, BRACKET, BOLD_DOUBLE_LEFT, BOLD_DOUBLE_RIGHT, THIN_DOUBLE } } class StaveHairpin { @@ -876,10 +872,9 @@ declare namespace Vex { renderHairpin(params : {first_x : number, last_x : number, first_y : number, last_y : number, staff_height : number}) : void; draw() : boolean; } - - namespace StaveLine { - const enum TextVerticalPosition {TOP, BOTTOM} - const enum TextJustification {LEFT, CENTER, RIGHT} + + namespace StaveHairpin { + const enum type { CRESC, DECRESC } } class StaveLine { @@ -896,6 +891,11 @@ declare namespace Vex { render_options : {padding_left : number, padding_right : number, line_width : number, line_dash : number[], rounded_end : boolean, color : string, draw_start_arrow : boolean, draw_end_arrow : boolean, arrowhead_length : number, arrowhead_angle : number, text_position_vertical : StaveLine.TextVerticalPosition, text_justification : StaveLine.TextJustification}; } + namespace StaveLine { + const enum TextVerticalPosition { TOP, BOTTOM } + const enum TextJustification { LEFT, CENTER, RIGHT } + } + class StaveModifier { getCategory() : string; makeSpacer(padding : number) : {getContext: Function, setStave: Function, renderToStave: Function, getMetrics: Function}; @@ -907,12 +907,6 @@ declare namespace Vex { addEndModifier() : void; } - namespace StaveNote { - const STEM_UP : number; - const STEM_DOWN : number; - const CATEGORY : string; - } - class StaveNote extends StemmableNote { //TODO remove the following lines once TypeScript allows subclass overrides with type changes and/or inconsistencies mentioned below are fixed buildStem() : StemmableNote; @@ -972,6 +966,12 @@ declare namespace Vex { drawStem(struct : {x_begin? : number, x_end? : number, y_top? : number, y_bottom? : number, y_extend? : number, stem_extension? : number, stem_direction? : number}) : void; draw() : void; } + + namespace StaveNote { + const STEM_UP: number; + const STEM_DOWN: number; + const CATEGORY: string; + } class StaveSection extends Modifier { //TODO remove the following lines once TypeScript allows subclass overrides with type changes @@ -1019,11 +1019,6 @@ declare namespace Vex { draw() : boolean; } - namespace Stem { - const UP : number; - const DOWN : number; - } - class Stem { constructor(options : {x_begin? : number, x_end? : number, y_top? : number, y_bottom? : number, y_extend? : number, stem_extension? : number, stem_direction? : number}); static DEBUG : boolean; @@ -1044,6 +1039,11 @@ declare namespace Vex { //inconsistent API: this should be set via the options object in the constructor hide : boolean; } + + namespace Stem { + const UP: number; + const DOWN: number; + } class StemmableNote extends Note { //TODO remove the following lines once TypeScript allows subclass overrides with type changes @@ -1071,10 +1071,6 @@ declare namespace Vex { drawStem(stem_struct : {x_begin? : number, x_end? : number, y_top? : number, y_bottom? : number, y_extend? : number, stem_extension? : number, stem_direction? : number}) : void; } - namespace StringNumber { - const CATEGORY : string; - } - class StringNumber extends Modifier { //TODO remove the following lines once TypeScript allows subclass overrides with type changes setNote(note : Note) : StringNumber; @@ -1095,10 +1091,9 @@ declare namespace Vex { setDashed(dashed : boolean) : StringNumber; draw() : void; } - - namespace Stroke { - const enum Type {BRUSH_DOWN, BRUSH_UP, ROLL_DOWN, ROLL_UP, RASQUEDO_DOWN, RASQUEDO_UP} - const CATEGORY : string; + + namespace StringNumber { + const CATEGORY: string; } class Stroke extends Modifier { @@ -1109,6 +1104,11 @@ declare namespace Vex { draw() : void; } + namespace Stroke { + const enum Type {BRUSH_DOWN, BRUSH_UP, ROLL_DOWN, ROLL_UP, RASQUEDO_DOWN, RASQUEDO_UP} + const CATEGORY : string; + } + class SVGContext implements IRenderContext { constructor(element : HTMLElement); iePolyfill() : boolean; @@ -1175,11 +1175,6 @@ declare namespace Vex { draw() : void; } - namespace TabSlide { - const SLIDE_UP : number; - const SLIDE_DOWN : number; - } - class TabSlide extends TabTie { constructor(notes : {first_note: Note, last_note: Note, first_indices : number[], last_indices : number[]}, direction? : number); static createSlideUp(notes : {first_note: Note, last_note: Note, first_indices : number[], last_indices : number[]}) : TabSlide; @@ -1187,6 +1182,11 @@ declare namespace Vex { renderTie(params : {first_ys : number[], last_ys : number[], last_x_px : number, first_x_px : number, direction : number}) : void; } + namespace TabSlide { + const SLIDE_UP : number; + const SLIDE_DOWN : number; + } + class TabStave extends Stave { constructor(x : number, y : number, width : number, options? : {vertical_bar_width? : number, glyph_spacing_px? : number, num_lines? : number, fill_style? : string, spacing_between_lines_px? : number, space_above_staff_ln? : number, space_below_staff_ln? : number, top_text_position? : number}); getYForGlyphs() : number; @@ -1200,10 +1200,6 @@ declare namespace Vex { draw() : boolean; } - namespace TextBracket { - const enum Positions {TOP, BOTTOM} - } - class TextBracket { constructor(bracket_data : {start : Note, stop : Note, text? : string, superscript? : string, position? : TextBracket.Positions}); static DEBUG : boolean; @@ -1215,6 +1211,10 @@ declare namespace Vex { draw() : void; } + namespace TextBracket { + const enum Positions {TOP, BOTTOM} + } + class TextDynamics extends Note { constructor(text_struct : {duration : string, text : string, line? : number}); static DEBUG : boolean; @@ -1222,11 +1222,6 @@ declare namespace Vex { preFormat() : TextDynamics; draw() : void; } - - namespace TextNote { - const enum Justification {LEFT, CENTER, RIGHT} - const GLYPHS : {[name : string] : {code : string, point : number, x_shift : number, y_shift : number}} - } class TextNote extends Note { constructor(text_struct : {duration : string, text? : string, superscript? : boolean, subscript? : boolean, glyph? : string, font? : {family : string, size : number, weight : string}, line? : number, smooth? : boolean, ignore_ticks? : boolean}); @@ -1236,6 +1231,11 @@ declare namespace Vex { draw() : void; } + namespace TextNote { + const enum Justification {LEFT, CENTER, RIGHT} + const GLYPHS : {[name : string] : {code : string, point : number, x_shift : number, y_shift : number}} + } + interface Tickable { setContext(context : IRenderContext) : void; getBoundingBox() : BoundingBox; @@ -1286,10 +1286,6 @@ declare namespace Vex { static getNextContext(tContext : TickContext) : TickContext; } - namespace TimeSignature { - const glyphs : {[name : string] : {code : string, point : number, line : number}}; - } - class TimeSignature extends StaveModifier { //TODO remove the following lines once TypeScript allows subclass overrides with type changes addModifier() : void; @@ -1303,6 +1299,10 @@ declare namespace Vex { addEndModifier(stave : Stave) : void; } + namespace TimeSignature { + const glyphs : {[name : string] : {code : string, point : number, line : number}}; + } + class TimeSigNote extends Note { //TODO remove the following lines once TypeScript allows subclass overrides with type changes or type inconsistencies mentioned below are fixed setStave(stave : Stave) : Note; @@ -1321,10 +1321,6 @@ declare namespace Vex { draw() : void; } - namespace Tuning { - const names : {[name : string] : string}; - } - class Tuning { constructor(tuningString? : string); noteToInteger(noteString : string) : number; @@ -1334,9 +1330,8 @@ declare namespace Vex { getNoteForFret(fretNum : string, stringNum : string) : string; } - namespace Tuplet { - const LOCATION_TOP : number; - const LOCATION_BOTTOM : number; + namespace Tuning { + const names: { [name: string]: string }; } class Tuplet { @@ -1354,9 +1349,10 @@ declare namespace Vex { resolveGlyphs() : void; draw() : void; } - - namespace Vibrato { - const CATEGORY : string; + + namespace Tuplet { + const LOCATION_TOP : number; + const LOCATION_BOTTOM : number; } class Vibrato extends Modifier { @@ -1366,8 +1362,8 @@ declare namespace Vex { draw() : void; } - namespace Voice { - const enum Mode {STRICT, SOFT, FULL} + namespace Vibrato { + const CATEGORY : string; } class Voice { @@ -1393,21 +1389,25 @@ declare namespace Vex { draw(context : IRenderContext, stave? : Stave) : void; } + namespace Voice { + const enum Mode {STRICT, SOFT, FULL} + } + class VoiceGroup { getVoices() : Voice[]; getModifierContexts() : ModifierContext[]; addVoice(voice : Voice) : void; } - namespace Volta { - const enum type {NONE, BEGIN, MID, END, BEGIN_END} - } - class Volta extends StaveModifier { constructor(type : Volta.type, number : number, x : number, y_shift : number); getCategory() : string; setShiftY(y : number) : Volta; draw(stave : Stave, x : number) : Volta; } + + namespace Volta { + const enum type {NONE, BEGIN, MID, END, BEGIN_END} + } } } \ No newline at end of file From 4d9af200a7d28cac4aece6660702294064cc03ca Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 17:48:02 -0700 Subject: [PATCH 032/167] Removed undocumented property in object literal in test for 'vexflow'. --- vexflow/vexflow-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vexflow/vexflow-tests.ts b/vexflow/vexflow-tests.ts index 351ad2ee8..742e3b00f 100644 --- a/vexflow/vexflow-tests.ts +++ b/vexflow/vexflow-tests.ts @@ -32,7 +32,7 @@ var gracenote = new Vex.Flow.GraceNote({keys: ["e/5"], duration: "16", slash: tr notes1[2].addModifier(0, new Vex.Flow.GraceNoteGroup([gracenote], true).beamNotes()); // Color the chord -notes1[3].setStyle({fillStyle: "blue", strokeStyle: "blue", stemStyle: "blue"}); +notes1[3].setStyle({fillStyle: "blue", strokeStyle: "blue"}); // Create a voice in 4/4 and add notes var voice1 = new Vex.Flow.Voice({ From d02c586416f77c441a6891df71700998e82b9e96 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 17:51:47 -0700 Subject: [PATCH 033/167] Fixed misspelled property for test of 'tedious-connection-pool'. --- tedious-connection-pool/tedious-connection-pool-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tedious-connection-pool/tedious-connection-pool-tests.ts b/tedious-connection-pool/tedious-connection-pool-tests.ts index aef2c9f60..60ca44d7e 100644 --- a/tedious-connection-pool/tedious-connection-pool-tests.ts +++ b/tedious-connection-pool/tedious-connection-pool-tests.ts @@ -16,7 +16,7 @@ var config: tedious.ConnectionConfig = { server: "127.0.0.1", options: { database: "somedb", - instance: "someinstance" + instanceName: "someinstance" } }; From 14c1dd16fe740802cf772e9818284e4b89b59b14 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 17:54:35 -0700 Subject: [PATCH 034/167] Add 'enclosure' property to 'podcast'. --- podcast/podcast.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/podcast/podcast.d.ts b/podcast/podcast.d.ts index cfe4766ad..c4e280d2d 100644 --- a/podcast/podcast.d.ts +++ b/podcast/podcast.d.ts @@ -64,6 +64,12 @@ interface IItemOptions date: Date; lat?: number; long?: number; + enclosure?: { + url: string; + file?: string; + size?: number; + mime?: string; + } itunesAuthor?: string; itunesExplicit?: boolean; itunesSubtitle?: string; From 0b2232d9414d363e7e9a1ed238ea0c4394959b58 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 27 Aug 2015 06:16:17 +0500 Subject: [PATCH 035/167] lodash: changed _.isBoolean() method --- lodash/lodash-tests.ts | 8 ++++++-- lodash/lodash.d.ts | 27 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bb7a66560..1cc61685b 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1207,6 +1207,12 @@ result = _(1).isArray(); result = _([]).isArray(); result = _({}).isArray(); +// _.isBoolean +result = _.isBoolean(any); +result = _(1).isBoolean(); +result = _([]).isBoolean(); +result = _({}).isBoolean(); + // _.isDate result = _.isDate(any); result = _(42).isDate(); @@ -1473,8 +1479,6 @@ interface FirstSecond { } result = _.invert({ 'first': 'moe', 'second': 'larry' }); -result = _.isBoolean(null); - result = _.isElement(document.body); // _.isEqual (alias: _.eq) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 43ba61f3b..f4ba8e428 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6196,6 +6196,23 @@ declare module _ { isArray(): boolean; } + //_.isBoolean + interface LoDashStatic { + /** + * Checks if value is classified as a boolean primitive or object. + * @param value The value to check. + * @return Returns true if value is correctly classified, else false. + **/ + isBoolean(value?: any): boolean; + } + + interface LoDashWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): boolean; + } + //_.isDate interface LoDashStatic { /** @@ -7063,16 +7080,6 @@ declare module _ { invert(object: any): any; } - //_.isBoolean - interface LoDashStatic { - /** - * Checks if value is a boolean value. - * @param value The value to check. - * @return True if the value is a boolean value, else false. - **/ - isBoolean(value?: any): boolean; - } - //_.isElement interface LoDashStatic { /** From 85df2c157bd54fea536626066bda175c0a46cbad Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 18:17:43 -0700 Subject: [PATCH 036/167] Fixed params for 'ui' in 'fbsdk'. --- fbsdk/fbsdk.d.ts | 59 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/fbsdk/fbsdk.d.ts b/fbsdk/fbsdk.d.ts index eb3f23269..8e575632b 100644 --- a/fbsdk/fbsdk.d.ts +++ b/fbsdk/fbsdk.d.ts @@ -15,10 +15,65 @@ interface FBInitParams{ xfbml ?: boolean; } -interface FBUIParams{ - method : string; +interface ShareDialogParams { + method: string; // "share" + href: string; } +interface PageTabDialogParams { + method: string; // "pagetab" + app_id: string; + redirect_uri?: string; + display?: any; +} + +interface RequestsDialogParams { + method: string; // "apprequests" + app_id: string; + redirect_uri?: string; + to?: string; + message: string; + action_type?: string; // "send" | "askfor" | "turn" + object_id?: string; + filters: string /* "app_users" | "app_non_users" */ | { + name: string; + user_ids: string[]; + }; + suggestions?: string[]; + exclude_ids?: string[]; + max_recipients?: number; + data?: string; + title?: string; +} + +interface SendDialogParams { + method: string; // "send" + app_id: string; + redirect_uri?: string; + display?: any; + to?: string; + link: string; +} + +interface PayDialogParams { + method: string; // "pay" + action: string; // "purchaseitem" + product: string; + quantity?: number; + quantity_min?: number; + quantity_max?: number; + request_id?: string; + pricepoint_id?: string; + test_currency?: string; +} + +// TODO: add login dialog, which isn't well-documented at all +declare type FBUIParams = ShareDialogParams + | PageTabDialogParams + | RequestsDialogParams + | SendDialogParams + | PayDialogParams; + interface FBLoginOptions{ auth_type ?: string; scope ?: string; From 2309ef1c42a670a32ece5121d6bd8687af6e58ed Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 18:19:09 -0700 Subject: [PATCH 037/167] Tabs to spaces, removed spaces before question marks in 'fbsdk'. --- fbsdk/fbsdk-tests.ts | 46 +++++++------- fbsdk/fbsdk.d.ts | 148 +++++++++++++++++++++---------------------- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/fbsdk/fbsdk-tests.ts b/fbsdk/fbsdk-tests.ts index e359369ad..8ec38d8bc 100644 --- a/fbsdk/fbsdk-tests.ts +++ b/fbsdk/fbsdk-tests.ts @@ -1,29 +1,29 @@ /// window.fbAsyncInit = function() { - FB.init( - { - appId : '{your-app-id}', - xfbml : true, - version : 'v2.0' - } - ); + FB.init( + { + appId : '{your-app-id}', + xfbml : true, + version : 'v2.0' + } + ); - FB.ui( - { - method: 'share', - href: 'https://developers.facebook.com/docs/dialogs/' - }, - function(response) { - console.log(response); - } - ); + FB.ui( + { + method: 'share', + href: 'https://developers.facebook.com/docs/dialogs/' + }, + function(response) { + console.log(response); + } + ); - FB.api( - "/me", - "POST", - function (fbResponse){ - console.log(fbResponse); - } - ); + FB.api( + "/me", + "POST", + function (fbResponse){ + console.log(fbResponse); + } + ); }; \ No newline at end of file diff --git a/fbsdk/fbsdk.d.ts b/fbsdk/fbsdk.d.ts index 8e575632b..8ecdbbdf8 100644 --- a/fbsdk/fbsdk.d.ts +++ b/fbsdk/fbsdk.d.ts @@ -4,15 +4,15 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped interface FBInitParams{ - appId ?: string; - authResponse ?: string; - cookie ?: boolean; - frictionlessRequests ?: boolean; - hideFlashCallback ?: Function; - logging ?: boolean; - status ?: boolean; - version ?: string; - xfbml ?: boolean; + appId?: string; + authResponse?: string; + cookie?: boolean; + frictionlessRequests?: boolean; + hideFlashCallback?: Function; + logging?: boolean; + status?: boolean; + version?: string; + xfbml?: boolean; } interface ShareDialogParams { @@ -75,116 +75,116 @@ declare type FBUIParams = ShareDialogParams | PayDialogParams; interface FBLoginOptions{ - auth_type ?: string; - scope ?: string; - return_scopes ?: boolean; - enable_profile_selector ?: boolean; - profile_selector_ids ?: string; + auth_type?: string; + scope?: string; + return_scopes?: boolean; + enable_profile_selector?: boolean; + profile_selector_ids?: string; } interface FBSDKEvents{ - /* This method allows you to subscribe to a range of events, and define callback functions for when they fire. */ - subscribe(event : string, callback : (fbResponseObject : Object) => any) : void; + /* This method allows you to subscribe to a range of events, and define callback functions for when they fire. */ + subscribe(event : string, callback : (fbResponseObject : Object) => any) : void; - /* This method allows you to un-subscribe a callback from any events previously subscribed to using .Event.subscribe(). */ - unsubscribe(event : string, callback : (fbResponseObject : Object) => any) : void; + /* This method allows you to un-subscribe a callback from any events previously subscribed to using .Event.subscribe(). */ + unsubscribe(event : string, callback : (fbResponseObject : Object) => any) : void; } interface FBSDKXFBML{ - /* This function parses and renders XFBML markup in a document on the fly. */ - parse(ParseElement ?: Element) : void; - parse(ParseElement ?: HTMLElement) : void; + /* This function parses and renders XFBML markup in a document on the fly. */ + parse(ParseElement?: Element) : void; + parse(ParseElement?: HTMLElement) : void; } interface FBSDKCanvasPrefetcher{ - /* Tells Facebook that the current page uses a specified resource. */ - addStaticResource(res : string) : void; + /* Tells Facebook that the current page uses a specified resource. */ + addStaticResource(res : string) : void; - /* Controls how statistics are collected on resources used by your application. */ - setCollectionMode(option : string) : void; + /* Controls how statistics are collected on resources used by your application. */ + setCollectionMode(option : string) : void; } interface FBSDKCanvasSize{ - height ?: Number; - width ?: Number; + height?: Number; + width?: Number; } interface FBSDKCanvasDoneLoading{ - time_delta_ms : Number; + time_delta_ms : Number; } interface FBSDKCanvas{ - Prefetcher : FBSDKCanvasPrefetcher; + Prefetcher : FBSDKCanvasPrefetcher; - /* Hides the HTML element passed in via the elem param from view. */ - hideFlashElement(element : Element) : void; - hideFlashElement(element : HTMLElement) : void; + /* Hides the HTML element passed in via the elem param from view. */ + hideFlashElement(element : Element) : void; + hideFlashElement(element : HTMLElement) : void; - /* Displays the HTML element passed in via the elem param, after it has been hidden via FB.Canvas.hideFlashElement. */ - showFlashElement(element : Element) : void; - showFlashElement(element : HTMLElement) : void; + /* Displays the HTML element passed in via the elem param, after it has been hidden via FB.Canvas.hideFlashElement. */ + showFlashElement(element : Element) : void; + showFlashElement(element : HTMLElement) : void; - /* Tells Facebook to scroll to a specific location of your canvas page. */ - scrollTo(x : Number, y : Number) : void; + /* Tells Facebook to scroll to a specific location of your canvas page. */ + scrollTo(x : Number, y : Number) : void; - /* Starts or stops a timer which will grow your iframe to fit the content every few milliseconds. */ - setAutoGrow(stopTimer : boolean) : void; - setAutoGrow(diffInterval : Number) : void; - setAutoGrow(stopTimer : boolean, diffInterval : Number) : void + /* Starts or stops a timer which will grow your iframe to fit the content every few milliseconds. */ + setAutoGrow(stopTimer : boolean) : void; + setAutoGrow(diffInterval : Number) : void; + setAutoGrow(stopTimer : boolean, diffInterval : Number) : void - /* Tells Facebook to resize your iframe. */ - setSize(canvasSizeOptions : FBSDKCanvasSize) : void; + /* Tells Facebook to resize your iframe. */ + setSize(canvasSizeOptions : FBSDKCanvasSize) : void; - /* Registers the callback for inline processing (i.e. without page reload) of user actions when they click on any link to the current app from Canvas */ - setUrlHandler(handler ?: Function) : string; + /* Registers the callback for inline processing (i.e. without page reload) of user actions when they click on any link to the current app from Canvas */ + setUrlHandler(handler?: Function) : string; - /* Calls you back with an integer, in milliseconds, of the timing of the page load, beginning from the time when the first bytes arrive on - the client, and ending from the point at which you call this function. - */ - setDoneLoading(handler ?: Function) : FBSDKCanvasDoneLoading; + /* Calls you back with an integer, in milliseconds, of the timing of the page load, beginning from the time when the first bytes arrive on + the client, and ending from the point at which you call this function. + */ + setDoneLoading(handler?: Function) : FBSDKCanvasDoneLoading; - /* Call startTimer to resume the timer after a period of time for the page load that you didn't wish to measure, which you began by calling stopTimer. */ - startTimer() : void; + /* Call startTimer to resume the timer after a period of time for the page load that you didn't wish to measure, which you began by calling stopTimer. */ + startTimer() : void; - /* Call stopTimer when you wish to stop timing the page load for a period of time */ - stopTimer(handler ?: (fbResponseObject : Object) => any) : void; + /* Call stopTimer when you wish to stop timing the page load for a period of time */ + stopTimer(handler?: (fbResponseObject : Object) => any) : void; } interface FBSDK{ - /* This method is used to initialize and setup the SDK. */ - init(fbInitObject : FBInitParams) : void; + /* This method is used to initialize and setup the SDK. */ + init(fbInitObject : FBInitParams) : void; - /* This method lets you make calls to the Graph API. */ - api(path : string, method : string, callback : (fbResponseObject : Object) => any) : Object; - api(path : string, params : Object, callback : (fbResponseObject : Object) => any) : Object; - api(path : string, method : string, params : Object, callback : (fbResponseObject : Object) => any) : Object; + /* This method lets you make calls to the Graph API. */ + api(path : string, method : string, callback : (fbResponseObject : Object) => any) : Object; + api(path : string, params : Object, callback : (fbResponseObject : Object) => any) : Object; + api(path : string, method : string, params : Object, callback : (fbResponseObject : Object) => any) : Object; - /* This method is used to trigger different forms of Facebook created UI dialogs. */ - ui(params : FBUIParams, handler : (fbResponseObject : Object) => any) : void; + /* This method is used to trigger different forms of Facebook created UI dialogs. */ + ui(params : FBUIParams, handler : (fbResponseObject : Object) => any) : void; - /* Allows you to determine if a user is logged in to Facebook and has authenticated your app */ - getLoginStatus(handler : Function, force ?: Boolean) : void; + /* Allows you to determine if a user is logged in to Facebook and has authenticated your app */ + getLoginStatus(handler : Function, force?: Boolean) : void; - /* Calling FB.login prompts the user to authenticate your application using the Login Dialog. */ - login(handler : (fbResponseObject : Object) => any, params ?: FBLoginOptions): void; + /* Calling FB.login prompts the user to authenticate your application using the Login Dialog. */ + login(handler : (fbResponseObject : Object) => any, params?: FBLoginOptions): void; - /* Log the user out of your site and Facebook */ - logout(handler : (fbResponseObject : Object) => any) : void; + /* Log the user out of your site and Facebook */ + logout(handler : (fbResponseObject : Object) => any) : void; - /* Synchronous accessor for the current authResponse. */ - getAuthResponse() : Object; + /* Synchronous accessor for the current authResponse. */ + getAuthResponse() : Object; - Event : FBSDKEvents; - XFBML : FBSDKXFBML; - Canvas : FBSDKCanvas; + Event : FBSDKEvents; + XFBML : FBSDKXFBML; + Canvas : FBSDKCanvas; } interface Window{ - fbAsyncInit() : any; + fbAsyncInit() : any; } declare module "FB" { - export = FB; + export = FB; } declare var FB : FBSDK; From c9b2b234a5f8f28df50ded178be61786f2204518 Mon Sep 17 00:00:00 2001 From: Jason Saelhof Date: Wed, 26 Aug 2015 22:07:11 -0600 Subject: [PATCH 038/167] Add missing PlayPropsConfig definition and some missing properties of the Sound object --- soundjs/soundjs.d.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/soundjs/soundjs.d.ts b/soundjs/soundjs.d.ts index 899063467..445006cab 100644 --- a/soundjs/soundjs.d.ts +++ b/soundjs/soundjs.d.ts @@ -142,7 +142,21 @@ declare module createjs { export class HTMLAudioTagPool { - } + } + + export class PlayPropsConfig + { + delay:number; + duration:number; + interrupt:string; + loop:number; + offset:number; + pan:number; + startTime:number; + volume:number; + static create( value:PlayPropsConfig|any ): PlayPropsConfig; + set ( props:any ): PlayPropsConfig; + } export class Sound extends EventDispatcher { @@ -160,8 +174,10 @@ declare module createjs { static PLAY_INITED: string; static PLAY_INTERRUPTED: string; static PLAY_SUCCEEDED: string; - static SUPPORTED_EXTENSIONS: string[]; - + static SUPPORTED_EXTENSIONS: string[]; + static muted: boolean; + static volume: number; + static capabilities: any; // methods static createInstance(src: string): AbstractSoundInstance; From 7071c7602728ddcebc92fefefd3cf158bfe54188 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 27 Aug 2015 00:20:30 -0700 Subject: [PATCH 039/167] Added 'optgroups' option property in 'selectize'. --- selectize/selectize.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/selectize/selectize.d.ts b/selectize/selectize.d.ts index 3ac665458..3a61334f5 100644 --- a/selectize/selectize.d.ts +++ b/selectize/selectize.d.ts @@ -183,6 +183,13 @@ declare module Selectize { */ valueField?: string; + /** + * Option groups that options will be bucketed into. + * If your element is a