From 86e45eece59da83db1c5de19931bcfacfe8cec83 Mon Sep 17 00:00:00 2001 From: James Fisher Date: Wed, 17 Jul 2013 23:06:52 +0100 Subject: [PATCH 01/15] jQuery (inner|outer)(Width|Height) are setters as well as getters This undocumented behavior is described in an open issue: https://github.com/jquery/api.jquery.com/issues/98 --- jquery/jquery-tests.ts | 24 ++++++++++++++++++++---- jquery/jquery.d.ts | 22 ++++++++++++++-------- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index db8309e06..c2ab118e2 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -1718,14 +1718,30 @@ function test_index() { $('div').html('Index: ' + foobar); } -function test_innedHeight() { +function test_innerHeight() { var p = $("p:first"); $("p:last").text("innerHeight:" + p.innerHeight()); + p.innerHeight(p.innerHeight() * 2).innerHeight(); } function test_innerWidth() { var p = $("p:first"); $("p:last").text("innerWidth:" + p.innerWidth()); + p.innerWidth(p.innerWidth() * 2).innerWidth(); +} + +function test_outerHeight() { + var p = $("p:first"); + $("p:last").text("outerHeight:" + p.outerHeight(true)); + p.outerHeight(p.outerHeight() * 2).outerHeight(); + p.outerHeight(p.outerHeight() * 2, true).outerHeight(); +} + +function test_outerWidth() { + var p = $("p:first"); + $("p:last").text("outerWidth:" + p.outerWidth(true)); + p.outerWidth(p.outerWidth() * 2).outerWidth(); + p.outerWidth(p.outerWidth() * 2, true).outerWidth(); } function test_insertAfter() { @@ -2272,15 +2288,15 @@ function test_parseHTML() { str = "hello, my name is jQuery.", html = $.parseHTML( str ), nodeNames = []; - + // Append the parsed HTML $log.append( html ); - + // Gather the parsed HTML's node names $.each( html, function( i, el ) { nodeNames[i] = "
  • " + el.nodeName + "
  • "; }); - + // Insert the node names $log.append( "

    Node Names:

    " ); $( "
      " ) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 1f1969814..e5ca2bd50 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -83,11 +83,11 @@ interface JQueryCallback { /* Allows jQuery Promises to interop with non-jQuery promises */ -interface JQueryGenericPromise { - then(onFulfill: (value: T) => U, onReject?: (reason) => U): JQueryGenericPromise; - then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (reason) => U): JQueryGenericPromise; - then(onFulfill: (value: T) => U, onReject?: (reason) => JQueryGenericPromise): JQueryGenericPromise; - then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (reason) => JQueryGenericPromise): JQueryGenericPromise; +interface JQueryGenericPromise { + then(onFulfill: (value: T) => U, onReject?: (reason) => U): JQueryGenericPromise; + then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (reason) => U): JQueryGenericPromise; + then(onFulfill: (value: T) => U, onReject?: (reason) => JQueryGenericPromise): JQueryGenericPromise; + then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (reason) => JQueryGenericPromise): JQueryGenericPromise; } /* @@ -102,9 +102,9 @@ interface JQueryPromise { // Deprecated - given no typings pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; - then(onFulfill: (value: T) => U, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; - then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; - then(onFulfill: (value: T) => U, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; + then(onFulfill: (value: T) => U, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; + then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (...reasons) => U, onProgress?: (...progression) => any): JQueryPromise; + then(onFulfill: (value: T) => U, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; then(onFulfill: (value: T) => JQueryGenericPromise, onReject?: (...reasons) => JQueryGenericPromise, onProgress?: (...progression) => any): JQueryPromise; // Because JQuery Promises Suck @@ -448,14 +448,20 @@ interface JQuery { height(func: (index: any, height: any) => any): JQuery; innerHeight(): number; + innerHeight(value: number): JQuery; + innerWidth(): number; + innerWidth(value: number): JQuery; offset(): { left: number; top: number; }; offset(coordinates: any): JQuery; offset(func: (index: any, coords: any) => any): JQuery; outerHeight(includeMargin?: boolean): number; + outerHeight(value: number, includeMargin?: boolean): JQuery; + outerWidth(includeMargin?: boolean): number; + outerWidth(value: number, includeMargin?: boolean): JQuery; position(): { top: number; left: number; }; From 8bd7d7ab8d23eceffcb848465126bfc46e986528 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 17 Jul 2013 18:34:48 -0700 Subject: [PATCH 02/15] Added request for CreateJS --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5176fe729..0e73a6ea3 100755 --- a/README.md +++ b/README.md @@ -201,3 +201,4 @@ Requested Definitions * [Lo-Dash](http://lodash.com/) * [java](https://github.com/nearinfinity/node-java) * [SVG.js](http://www.svgjs.com/) +* [CreateJS](http://createjs.com/) From bcbe4c1199f2227b289726e2fdf090aafab2845e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Vor=C3=A1=C4=8Dek?= Date: Thu, 18 Jul 2013 14:39:16 +0200 Subject: [PATCH 03/15] unwrapObservable should be generic --- knockout/knockout.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 63e3ee61d..0beebeb3e 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -289,7 +289,7 @@ interface KnockoutUtils { triggerEvent(element: any, eventType: any): void; - unwrapObservable(value: any): any; + unwrapObservable(value: KnockoutObservable): T; toggleDomNodeCssClass(node: any, className: string, shouldHaveClass: boolean): void; From 4bb981d94c645ad3f88a49d77d332ff1f553925d Mon Sep 17 00:00:00 2001 From: Jeffery Grajkowski Date: Thu, 18 Jul 2013 10:59:31 -0700 Subject: [PATCH 04/15] Intl support The Intl object is the namespace for the ECMAScript Internationalization API, which provides language sensitive string comparison, number formatting, and date and time formatting. It is not yet support in all modern browsers and is not in lib.d.ts. --- README.md | 1 + intl/intl-tests.ts | 90 +++++++++++++++++++++++++++++++++++++++ intl/intl.d.ts | 102 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 193 insertions(+) create mode 100644 intl/intl-tests.ts create mode 100644 intl/intl.d.ts diff --git a/README.md b/README.md index 5176fe729..65e58c221 100755 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ List of Definitions * [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter)) * [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz)) * [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov)) +* [Intl](http://www.ecma-international.org/ecma-402/1.0/) (by [Jeffery Grajkowski](http://github.com/pushplay)) * [iScroll](http://cubiq.org/iscroll-4) (by [Boris Yankov](https://github.com/borisyankov)) * [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/)) * [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov)) diff --git a/intl/intl-tests.ts b/intl/intl-tests.ts new file mode 100644 index 000000000..d2a996739 --- /dev/null +++ b/intl/intl-tests.ts @@ -0,0 +1,90 @@ +/// + +// Collator + +alert(Intl.Collator.supportedLocalesOf(["ban", "id-u-co-pinyin", "de-ID"], { localeMatcher: "lookup" }).join(", ")); +// → "id-u-co-pinyin, de-ID" + +// in German, ä sorts with a +alert(new Intl.Collator("de").compare("ä", "z").toString()); +// → a negative value + +// in Swedish, ä sorts after z +alert(new Intl.Collator("sv").compare("ä", "z").toString()); +// → a positive value + +// in German, ä has a as the base letter +alert(new Intl.Collator("de", { sensitivity: "base" }).compare("ä", "a").toString()); +// → 0 + +// in Swedish, ä and a are separate base letters +alert(new Intl.Collator("sv", { sensitivity: "base" }).compare("ä", "a").toString()); +// → a positive value + +var a = ["Offenbach", "Österreich", "Odenwald"]; +var collator = new Intl.Collator("de-u-co-phonebk"); +a.sort(collator.compare); +alert(a.join(", ")); +// → "Odenwald, Österreich, Offenbach" + + +// DateTimeFormat + +alert(Intl.DateTimeFormat.supportedLocalesOf(["ban", "id-u-co-pinyin", "de-ID"], { localeMatcher: "lookup" }).join(", ")); +// → "id-u-co-pinyin, de-ID" + +// toLocaleString without arguments depends on the implementation, +// the default locale, and the default time zone +alert(new Intl.DateTimeFormat().format(new Date(Date.UTC(2012, 11, 20, 3, 0, 0)))); +// → "12/19/2012" if run in en-US locale with time zone America/Los_Angeles + +alert(new Intl.DateTimeFormat("sr-RS", { weekday: "long", year: "numeric", month: "long", day: "numeric" }).format(new Date())); +// → "недеља, 7. април 2013." + +alert([new Date(2012, 08), new Date(2012, 11), new Date(2012, 03)].map(new Intl.DateTimeFormat("pt-BR", { year: "numeric", month: "long" }).format).join("; ")); +// → "setembro de 2012; dezembro de 2012; abril de 2012" + + +// NumberFormat + +alert(Intl.NumberFormat.supportedLocalesOf(["ban", "id-u-co-pinyin", "de-ID"], { localeMatcher: "lookup" }).join(", ")); +// → "id-u-co-pinyin, de-ID" + +alert(new Intl.NumberFormat("ru-RU", { style: "currency", currency: "RUB" }).format(654321.987)); +// → "654 321,99 руб." + +alert([123456.789, 987654.321, 456789.123].map(new Intl.NumberFormat("es-ES").format).join("; ")); +// → "123.456,789; 987.654,321; 456.789,123" + +// German uses comma as decimal separator and period for thousands +alert(new Intl.NumberFormat("de-DE").format(123456.789)); +// → 123.456,789 + +// Arabic in most Arabic speaking countries uses real Arabic digits +alert(new Intl.NumberFormat("ar-EG").format(123456.789)); +// → ١٢٣٤٥٦٫٧٨٩ + +// India uses thousands/lakh/crore separators +alert(new Intl.NumberFormat("en-IN").format(123456.789)); +// → 1,23,456.789 + +// the nu extension key requests a numbering system, e.g. Chinese decimal +alert(new Intl.NumberFormat("zh-Hans-CN-u-nu-hanidec").format(123456.789)); +// → 一二三,四五六.七八九 + +// when requesting a language that may not be supported, such as +// Balinese, include a fallback language, in this case Indonesian +alert(new Intl.NumberFormat(["ban", "id"]).format(123456.789)); +// → 123.456,789 + +// request a currency format +alert(new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(123456.789)); +// → 123.456,79 € + +// the Japanese yen doesn't use a minor unit +alert(new Intl.NumberFormat("ja-JP", { style: "currency", currency: "JPY" }).format(123456.789)) +// → ¥123,457 + +// limit to three significant digits +alert(new Intl.NumberFormat("en-IN", { maximumSignificantDigits: 3 }).format(123456.789)); +// → 1,23,000 \ No newline at end of file diff --git a/intl/intl.d.ts b/intl/intl.d.ts new file mode 100644 index 000000000..bc3359483 --- /dev/null +++ b/intl/intl.d.ts @@ -0,0 +1,102 @@ +// Type definitions for Intl +// Project: http://www.ecma-international.org/ecma-402/1.0/ +// Definitions by: Jeffery Grajkowski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Intl { + + export interface SupportedLocalesOfOptions { + localeMatcher?: string; + } + + export interface CollatorOptions { + localeMatcher?: string; + usage?: string; + sensitivity?: string; + ignorePunctuation?: boolean; + numeric?: boolean; + caseFirst?: string; + } + + export class Collator { + constructor(locales?: string, options?: CollatorOptions); + constructor(locales?: string[], options?: CollatorOptions); + static supportedLocalesOf(locales: string, options?: SupportedLocalesOfOptions): string[]; + static supportedLocalesOf(locales: string[], options?: SupportedLocalesOfOptions): string[]; + compare(string1: string, string2: string): number; + resolvedOptions(): { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + numeric: boolean; + caseFirst: string; + }; + } + + export interface DateTimeFormatOptions { + localeMatcher?: string; + timeZone?: string; + hour12?: boolean; + formatMatcher?: boolean; + } + + export class DateTimeFormat { + constructor(locales?: string, options?: DateTimeFormatOptions); + constructor(locales?: string[], options?: DateTimeFormatOptions); + static supportedLocalesOf(locales: string, options?: SupportedLocalesOfOptions): string[]; + static supportedLocalesOf(locales: string[], options?: SupportedLocalesOfOptions): string[]; + format(date: Date): string; + resolvedOptions(): { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + }; + } + + export interface NumberFormatOptions { + localeMatcher?: string; + style?: string; + currency?: string; + currencyDisplay?: string; + useGrouping?: boolean; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + + export class NumberFormat { + constructor(locales?: string, options?: NumberFormatOptions); + constructor(locales?: string[], options?: NumberFormatOptions); + static supportedLocalesOf(locales: string, options?: SupportedLocalesOfOptions): string[]; + static supportedLocalesOf(locales: string[], options?: SupportedLocalesOfOptions): string[]; + format(n: number): string; + resolvedOptions(): { + locale: string; + numberingSystem: string; + style: string; + useGrouping: boolean; + currency?: string; + currencyDisplay?: string; + minimumIntegerDigits?: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + } + } +} \ No newline at end of file From d9ebddeae241b95e713ebb7501a5e43a8a38d847 Mon Sep 17 00:00:00 2001 From: vvakame Date: Fri, 19 Jul 2013 11:55:45 +0900 Subject: [PATCH 05/15] Added definition for Firefox Web API --- README.md | 1 + firefox/firefox-test.ts | 28 ++++++++++++++++++++++++++++ firefox/firefox.d.ts | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 firefox/firefox-test.ts create mode 100644 firefox/firefox.d.ts diff --git a/README.md b/README.md index 5176fe729..64740d320 100755 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ List of Definitions * [File API: Writer](http://www.w3.org/TR/file-writer-api/) (by [Kon](http://phyzkit.net/)) * [Finite State Machine](https://github.com/jakesgordon/javascript-state-machine) (by [Boris Yankov](https://github.com/borisyankov)) * [Firebase](https://www.firebase.com/docs/javascript/firebase) (by [Vincent Bortone](https://github.com/vbortone)) +* [Firefox](https://developer.mozilla.org/en-US/docs/Web/API) (by [vvakame](https://github.com/vvakame)) * [FlexSlider](http://www.woothemes.com/flexslider/) (by [Diullei Gomes](https://github.com/Diullei)) * [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros)) diff --git a/firefox/firefox-test.ts b/firefox/firefox-test.ts new file mode 100644 index 000000000..30f7d7493 --- /dev/null +++ b/firefox/firefox-test.ts @@ -0,0 +1,28 @@ +/// + +var manifestUrl = window.location.protocol + "//" + window.location.host + "/manifest.webapp"; + +var log = (data:any) => { + alert(data); +}; + +var setupCallback = (src:string, request:DOMRequest) => { + request.onsuccess = (data)=> { + if (request.result && request.result.manifest) { + log('app is installed ' + request.result.manifest.name + " by " + src); + } else if (request.result) { + // bug 806597. https://bugzilla.mozilla.org/show_bug.cgi?id=806597 + log("app is installed by " + src); + } else { + log("app is not installed by " + src); + } + }; + request.onerror = ()=> { + log('failed, error: ' + request.error.name + " by " + src); + }; +}; + +var apps = navigator.mozApps; +setupCallback("install", apps.install(manifestUrl)); +setupCallback("checkInstalled", apps.checkInstalled(manifestUrl)); +setupCallback("getSelf", apps.getSelf()); diff --git a/firefox/firefox.d.ts b/firefox/firefox.d.ts new file mode 100644 index 000000000..dd052f1a8 --- /dev/null +++ b/firefox/firefox.d.ts @@ -0,0 +1,39 @@ +// Type definitions for Mozilla Web API +// Project: https://developer.mozilla.org/en-US/docs/Web/API +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// required lib.d.ts + +// expand Navigator definietion. +interface Navigator { + mozApps:Apps; +} + +interface Apps { + install(url:string, receipts?:any[]):DOMRequest; + getSelf():DOMRequest; + getInstalled():DOMRequest; + checkInstalled(url:string): DOMRequest; +} + +interface DOMRequest { + onsuccess: Function; + onerror: Function; + readyState:string; // "done" or "pending" + result:T; + error:DOMError; +} + +interface App { + manifest:any; + manifestURL:string; + origin:string; + installOrigin:string; + installTime:number; + receipts:any[]; + + launch(); + checkForUpdate():DOMRequest; +} + From 274667b7604faca2eb94e56d798863ed70920fea Mon Sep 17 00:00:00 2001 From: Diullei Gomes Date: Fri, 19 Jul 2013 12:11:20 -0300 Subject: [PATCH 06/15] bug fix - node test --- node/node.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 96fa847e1..dfcbee7b7 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1019,8 +1019,8 @@ declare module "util" { } declare module "assert" { - export function internal (booleanValue: boolean, message?: string): void; - export module internal { + function internal (booleanValue: boolean, message?: string): void; + module internal { export function fail(actual: any, expected: any, message: string, operator: string): void; export function assert(value: any, message: string): void; export function ok(value: any, message?: string): void; @@ -1034,6 +1034,8 @@ declare module "assert" { export function doesNotThrow(block: any, error?: any, messsage?: string): void; export function ifError(value: any): void; } + + export = internal; } declare module "tty" { From 5031efe99918926d45d77e3905c3a7718e29e24b Mon Sep 17 00:00:00 2001 From: basarat Date: Sat, 20 Jul 2013 23:11:52 +1000 Subject: [PATCH 07/15] http://raphaeljs.com/reference.html#Raphael.getColor fixed invalid typescript http://raphaeljs.com/reference.html#Raphael.getColor --- raphael/raphael.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raphael/raphael.d.ts b/raphael/raphael.d.ts index 26a183d2d..5deac9d13 100644 --- a/raphael/raphael.d.ts +++ b/raphael/raphael.d.ts @@ -244,7 +244,7 @@ interface RaphaelStatic { fn: any; format(token: string, ...parameters: any[]): string; fullfill(token: string, json: JSON): string; - getColor { + getColor:{ (value?: number): string; reset(); }; From 8439d657c13aed3215c32083e620723de06c70fa Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 21 Jul 2013 11:23:38 -0500 Subject: [PATCH 08/15] bool -> boolean in jquery.cookie --- jquery.cookie/jquery.cookie-tests.ts | 2 +- jquery.cookie/jquery.cookie.d.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jquery.cookie/jquery.cookie-tests.ts b/jquery.cookie/jquery.cookie-tests.ts index 6bf057757..69a8c0412 100644 --- a/jquery.cookie/jquery.cookie-tests.ts +++ b/jquery.cookie/jquery.cookie-tests.ts @@ -15,7 +15,7 @@ class CookieOptions implements JQueryCookieOptions { expires: number; path: string; domain: string; - secure: bool; + secure: boolean; } $.cookie("the_cookie", "the_value"); diff --git a/jquery.cookie/jquery.cookie.d.ts b/jquery.cookie/jquery.cookie.d.ts index 3c5f05192..0fc82d846 100644 --- a/jquery.cookie/jquery.cookie.d.ts +++ b/jquery.cookie/jquery.cookie.d.ts @@ -10,12 +10,12 @@ interface JQueryCookieOptions { expires?: any; path?: string; domain?: string; - secure?: bool; + secure?: boolean; } interface JQueryCookieStatic { - raw?: bool; - json?: bool; + raw?: boolean; + json?: boolean; (name: string): any; (name: string, value: string): void; @@ -27,6 +27,6 @@ interface JQueryCookieStatic { interface JQueryStatic { cookie?: JQueryCookieStatic; - removeCookie(name: string): bool; - removeCookie(name: string, options: JQueryCookieOptions): bool; + removeCookie(name: string): boolean; + removeCookie(name: string, options: JQueryCookieOptions): boolean; } \ No newline at end of file From 4c5af1c3fa16e55b3d79c411e8cfe77fc0c0a230 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 21 Jul 2013 11:28:25 -0500 Subject: [PATCH 09/15] bool -> boolean in spin.js --- spin/spin.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spin/spin.d.ts b/spin/spin.d.ts index f48adbb5e..becf2f58e 100644 --- a/spin/spin.d.ts +++ b/spin/spin.d.ts @@ -15,8 +15,8 @@ interface SpinnerOptions { color?: string; // #rgb or #rrggbb speed?: number; // Rounds per second trail?: number; // Afterglow percentage - shadow?: bool; // Whether to render a shadow - hwaccel?: bool; // Whether to use hardware acceleration + shadow?: boolean; // Whether to render a shadow + hwaccel?: boolean; // Whether to use hardware acceleration className?: string; // The CSS class to assign to the spinner zIndex?: number; // The z-index (defaults to 2000000000) top?: string; // Top position relative to parent in px @@ -30,4 +30,4 @@ declare class Spinner { stop(); lines(el, o); opacity(el, i, val); -} +} From fb2e396858135e589311be7a1c796ce5f8ae225f Mon Sep 17 00:00:00 2001 From: Utkarsh Upadhyay Date: Sun, 21 Jul 2013 21:45:19 +0200 Subject: [PATCH 10/15] Fix issue #668. Change the spellings of Types/docs to American English. --- d3/d3.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index b12dc01c1..07409eeee 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -58,9 +58,9 @@ declare module D3 { export interface Base extends Selectors { /** - * Create a behaviour + * Create a behavior */ - behavior: Behaviour.Behavior; + behavior: Behavior.Behavior; /** * Access the current user event for interaction */ @@ -167,7 +167,7 @@ declare module D3 { /** * Randomize the order of an array. * - * @param arr Array to randomise + * @param arr Array to randomize */ shuffle(arr: T[]): T[]; /** @@ -344,15 +344,15 @@ declare module D3 { */ interpolateString: Transition.BaseInterpolate; /* - * Interpolate two RGB colours + * Interpolate two RGB colors */ interpolateRgb: Transition.BaseInterpolate; /* - * Interpolate two HSL colours + * Interpolate two HSL colors */ interpolateHsl: Transition.BaseInterpolate; /* - * Interpolate two HCL colours + * Interpolate two HCL colors */ interpolateHcl: Transition.BaseInterpolate; /* @@ -1366,7 +1366,7 @@ declare module D3 { } } - // Colour + // Color export module Color { export interface Color { /** From d559a14e790dc586e5e7f42ec4814d6763ee4177 Mon Sep 17 00:00:00 2001 From: vvakame Date: Mon, 22 Jul 2013 12:29:57 +0900 Subject: [PATCH 11/15] Renamed firefox-test.ts to firefox-tests.ts --- firefox/{firefox-test.ts => firefox-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename firefox/{firefox-test.ts => firefox-tests.ts} (100%) diff --git a/firefox/firefox-test.ts b/firefox/firefox-tests.ts similarity index 100% rename from firefox/firefox-test.ts rename to firefox/firefox-tests.ts From 661adf0b644f664f8a67f0ac98c2d7319060c5ec Mon Sep 17 00:00:00 2001 From: jfoliveira Date: Mon, 22 Jul 2013 14:47:40 +0100 Subject: [PATCH 12/15] Added getSubscriptionsCount function to KnockoutComputedFunctions This function was missing and is expected to be available to all KnockoutComputer objects, as stated in the docs: http://knockoutjs.com/documentation/computedObservables.html#computed_observable_reference --- knockout/knockout.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 0beebeb3e..d46879018 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -15,6 +15,7 @@ interface KnockoutSubscribableFunctions { interface KnockoutComputedFunctions extends KnockoutSubscribableFunctions { getDependenciesCount(): number; + getSubscriptionsCount(): number; hasWriteFunction(): boolean; } From b0f8d750357796128feb0a06ddf48c59d21c03f5 Mon Sep 17 00:00:00 2001 From: Diullei Gomes Date: Mon, 22 Jul 2013 12:28:19 -0300 Subject: [PATCH 13/15] bug fix - d3 --- d3/d3.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 07409eeee..67dca5fec 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -2585,7 +2585,7 @@ declare module D3 { } // Behaviour - export module Behaviour { + export module Behavior { export interface Behavior{ /** * Constructs a new drag behaviour From 1a32cce3e01583fb5761aa014a0ac524387f60b9 Mon Sep 17 00:00:00 2001 From: James Hudon Date: Tue, 23 Jul 2013 23:13:45 -0400 Subject: [PATCH 14/15] AngularJS: give an interface to $http callback functions - add IHttpPromiseCallback for both `error` and `success` promise calls use case is if we're passing around the callback, we don't want to be repeating that entire function declaration every time, and we cannot use `Function` as that doesn't satisfy the compiler. (see test case) --- angularjs/angular-tests.ts | 14 ++++++++++++++ angularjs/angular.d.ts | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 3ea1371f4..eab0d6081 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -137,6 +137,20 @@ module HttpAndRegularPromiseTests { $scope.letters = letters; }); } + + // Test that we can pass around a type-checked success/error Promise Callback + var anotherController: Function = ($scope: SomeControllerScope, $http: + ng.IHttpService, $q: ng.IQService) => { + + var buildFooData: Function = () => 42; + + var doFoo: Function = (callback: ng.IHttpPromiseCallback) => { + $http.get('/foo', buildFooData()) + .success(callback); + } + + doFoo((data) => console.log(data)); + } } // Test for AngularJS Syntac diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 22f4cbf72..3eda659e8 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -531,6 +531,10 @@ declare module ng { transformResponse?: any; } + interface IHttpPromiseCallback { + (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig): any; + } + interface IHttpPromiseCallbackArg { data?: any; status?: number; @@ -539,8 +543,8 @@ declare module ng { } interface IHttpPromise extends IPromise { - success(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise; - error(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise; + success(callback: IHttpPromiseCallback): IHttpPromise; + error(callback: IHttpPromiseCallback): IHttpPromise; then(successCallback: (response: IHttpPromiseCallbackArg) => any, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; } From 0d35893c08c1b45a8afee2d635f7613ca9e79222 Mon Sep 17 00:00:00 2001 From: jraymakers Date: Thu, 25 Jul 2013 22:56:10 -0700 Subject: [PATCH 15/15] Replace bool with boolean in angular --- angularjs/angular-resource.d.ts | 2 +- angularjs/angular.d.ts | 70 ++++++++++++++++----------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 37b491d74..c66bb341d 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -28,7 +28,7 @@ declare module ng.resource { // Just a reference to facilitate describing new actions interface IActionDescriptor { method: string; - isArray?: bool; + isArray?: boolean; params?: any; headers?: any; } diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 3eda659e8..d9c948a15 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -29,21 +29,21 @@ declare module ng { bootstrap(element: Element, modules?: any[]): auto.IInjectorService; copy(source: any, destination?: any): any; element: JQueryStatic; - equals(value1: any, value2: any): bool; + equals(value1: any, value2: any): boolean; extend(destination: any, ...sources: any[]): any; forEach(obj: any, iterator: (value, key) => any, context?: any): any; fromJson(json: string): any; identity(arg?: any): any; injector(modules?: any[]): auto.IInjectorService; - isArray(value: any): bool; - isDate(value: any): bool; - isDefined(value: any): bool; - isElement(value: any): bool; - isFunction(value: any): bool; - isNumber(value: any): bool; - isObject(value: any): bool; - isString(value: any): bool; - isUndefined(value: any): bool; + isArray(value: any): boolean; + isDate(value: any): boolean; + isDefined(value: any): boolean; + isElement(value: any): boolean; + isFunction(value: any): boolean; + isNumber(value: any): boolean; + isObject(value: any): boolean; + isString(value: any): boolean; + isUndefined(value: any): boolean; lowercase(str: string): string; /** construct your angular application official docs: Interface for configuring angular modules. @@ -56,7 +56,7 @@ declare module ng { requires?: string[], configFunction?: any): IModule; noop(...args: any[]): void; - toJson(obj: any, pretty?: bool): string; + toJson(obj: any, pretty?: boolean): string; uppercase(str: string): string; version: { full: string; @@ -128,10 +128,10 @@ declare module ng { // see http://docs.angularjs.org/api/ng.directive:form.FormController /////////////////////////////////////////////////////////////////////////// interface IFormController { - $pristine: bool; - $dirty: bool; - $valid: bool; - $invalid: bool; + $pristine: boolean; + $dirty: boolean; + $valid: boolean; + $invalid: boolean; $error: any; } @@ -141,7 +141,7 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface INgModelController { $render(): void; - $setValidity(validationErrorKey: string, isValid: bool): void; + $setValidity(validationErrorKey: string, isValid: boolean): void; $setViewValue(value: string): void; // XXX Not sure about the types here. Documentation states it's a string, but @@ -155,10 +155,10 @@ declare module ng { $parsers: IModelParser[]; $formatters: IModelFormatter[]; $error: any; - $pristine: bool; - $dirty: bool; - $valid: bool; - $invalid: bool; + $pristine: boolean; + $dirty: boolean; + $valid: boolean; + $invalid: boolean; } interface IModelParser { @@ -192,14 +192,14 @@ declare module ng { $evalAsync(expression: (scope: IScope) => any): void; // Defaults to false by the implementation checking strategy - $new(isolate?: bool): IScope; + $new(isolate?: boolean): IScope; $on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function; - $watch(watchExpression: string, listener?: string, objectEquality?: bool): Function; - $watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: bool): Function; - $watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function; + $watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function; + $watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; + $watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function; + $watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function; $parent: IScope; @@ -211,7 +211,7 @@ declare module ng { currentScope: IScope; name: string; preventDefault: Function; - defaultPrevented: bool; + defaultPrevented: boolean; // Available only events that were $emit-ted stopPropagation?: Function; @@ -234,8 +234,8 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$timeout /////////////////////////////////////////////////////////////////////////// interface ITimeoutService { - (func: Function, delay?: number, invokeApply?: bool): IPromise; - cancel(promise: IPromise): bool; + (func: Function, delay?: number, invokeApply?: boolean): IPromise; + cancel(promise: IPromise): boolean; } /////////////////////////////////////////////////////////////////////////// @@ -360,12 +360,12 @@ declare module ng { interface ILocationProvider extends IServiceProvider { hashPrefix(): string; hashPrefix(prefix: string): ILocationProvider; - html5Mode(): bool; + html5Mode(): boolean; // Documentation states that parameter is string, but // implementation tests it as boolean, which makes more sense // since this is a toggler - html5Mode(active: bool): ILocationProvider; + html5Mode(active: boolean): ILocationProvider; } /////////////////////////////////////////////////////////////////////////// @@ -523,7 +523,7 @@ declare module ng { cache?: any; timeout?: number; - withCredentials?: bool; + withCredentials?: boolean; // These accept multiple types, so let's defile them as any data?: any; @@ -560,7 +560,7 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface IHttpBackendService { // XXX Perhaps define callback signature in the future - (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: bool): void; + (method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void; } /////////////////////////////////////////////////////////////////////////// @@ -569,7 +569,7 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$interpolateProvider /////////////////////////////////////////////////////////////////////////// interface IInterpolateService { - (text: string, mustHaveExpression?: bool): IInterpolationFunction; + (text: string, mustHaveExpression?: boolean): IInterpolationFunction; endSymbol(): string; startSymbol(): string; } @@ -624,7 +624,7 @@ declare module ng { templateUrl?: string; resolve?: any; redirectTo?: any; - reloadOnSearch?: bool; + reloadOnSearch?: boolean; } // see http://docs.angularjs.org/api/ng.$route#current @@ -650,7 +650,7 @@ declare module ng { priority?: number; template?: string; templateUrl?: string; - replace?: bool; + replace?: boolean; transclude?: any; restrict?: string; scope?: any;