diff --git a/README.md b/README.md index 5176fe729..0bccaa28f 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)) @@ -83,6 +84,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)) @@ -201,3 +203,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/) 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-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..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; @@ -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; } @@ -556,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; } /////////////////////////////////////////////////////////////////////////// @@ -565,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; } @@ -620,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 @@ -646,7 +650,7 @@ declare module ng { priority?: number; template?: string; templateUrl?: string; - replace?: bool; + replace?: boolean; transclude?: any; restrict?: string; scope?: any; diff --git a/d3/d3.d.ts b/d3/d3.d.ts index b12dc01c1..67dca5fec 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 { /** @@ -2585,7 +2585,7 @@ declare module D3 { } // Behaviour - export module Behaviour { + export module Behavior { export interface Behavior{ /** * Constructs a new drag behaviour diff --git a/firefox/firefox-tests.ts b/firefox/firefox-tests.ts new file mode 100644 index 000000000..30f7d7493 --- /dev/null +++ b/firefox/firefox-tests.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; +} + 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 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 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; }; diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 63e3ee61d..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; } @@ -289,7 +290,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; 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" { 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(); }; 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); -} +}