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/131] 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 0000000000..5500d914e2 --- /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 0000000000..01e4b070ea --- /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/131] 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 5500d914e2..706fb67fe0 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 01e4b070ea..d226801dc4 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/131] 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 706fb67fe0..9a10f1062f 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 d226801dc4..1a88ef1641 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/131] 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 7770e7c9b8..55ddf76973 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 cd21d77e92..a0ccd30ec5 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/131] 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 55ddf76973..f338678c79 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 a22c78d619f18548081e69ce68b950dc6265a74a Mon Sep 17 00:00:00 2001 From: Alexander Horn Date: Mon, 24 Aug 2015 21:00:14 +0200 Subject: [PATCH 006/131] 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 f671a63726..97df14dbf4 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 9b6ed79988..715c799a2f 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 bb1b99052bf1d697f0368fbff56898bc1f5a525c Mon Sep 17 00:00:00 2001 From: Roman Salnikov Date: Wed, 26 Aug 2015 11:07:48 +0500 Subject: [PATCH 007/131] 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 98dc1567df..2af4565ccb 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 5c69bdeb4541a496f65171559a5de025e6a126b3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 15:26:57 -0700 Subject: [PATCH 008/131] 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 954e3358ba..c816a533a3 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 009/131] 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 0000000000..497f9fda5c --- /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 010/131] 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 0000000000..5ad4d26d5f --- /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 011/131] 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 1822c0c67e..bba0c6a44b 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 012/131] 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 bba0c6a44b..c17e96576e 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 013/131] 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 351ad2ee88..742e3b00fa 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 014/131] 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 aef2c9f605..60ca44d7e9 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 015/131] 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 cfe4766ad7..c4e280d2db 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 85df2c157bd54fea536626066bda175c0a46cbad Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Aug 2015 18:17:43 -0700 Subject: [PATCH 016/131] 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 eb3f232695..8e575632b3 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 017/131] 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 e359369adf..8ec38d8bc4 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 8e575632b3..8ecdbbdf8c 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 018/131] 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 8990634674..445006cabf 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 019/131] 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 3ac665458d..3a61334f56 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