diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 801a1d07a..4c2fbc8e1 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -218,6 +218,7 @@ All definitions files include a header with the author and editors, so at some p * [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk)) * [Minimatch](https://github.com/isaacs/minimatch) (by [vvakame](https://github.com/vvakame)) * [minimist](https://github.com/substack/minimist) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [Mixpanel](https://github.com/mixpanel/mixpanel-js) (by [Knut Eirik Leira Hjelle](https://github.com/hjellek)) * [mixto](https://github.com/atom/mixto) (by [vvakame](https://github.com/vvakame)) * [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/)) * [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield)) @@ -326,6 +327,7 @@ All definitions files include a header with the author and editors, so at some p * [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) (from TypeScript samples) * [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd)) * [x2js](https://code.google.com/p/x2js/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) (by [Michel Salib](https://github.com/michelsalib)) * [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds)) * [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/)) * [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy)) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 4e2aa7607..d4e35b7e2 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -15,7 +15,9 @@ declare module ng.route { // RouteParamsService // see http://docs.angularjs.org/api/ngRoute.$routeParams /////////////////////////////////////////////////////////////////////////// - interface IRouteParamsService {} + interface IRouteParamsService { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // RouteService diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index ec8c5cb5b..92a02eef8 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -203,6 +203,7 @@ declare module ng { $error: any; $addControl(control: ng.INgModelController): void; $removeControl(control: ng.INgModelController): void; + $setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void; $setDirty(): void; $setPristine(): void; } @@ -302,13 +303,17 @@ declare module ng { // WindowService // see http://docs.angularjs.org/api/ng.$window /////////////////////////////////////////////////////////////////////////// - interface IWindowService extends Window {} + interface IWindowService extends Window { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // BrowserService // TODO undocumented, so we need to get it from the source code /////////////////////////////////////////////////////////////////////////// - interface IBrowserService {} + interface IBrowserService { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // TimeoutService diff --git a/async/async.d.ts.tscparams b/async/async.d.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/async/async.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/async/asyncamd-tests.ts.tscparams b/async/asyncamd-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/async/asyncamd-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts b/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts new file mode 100644 index 000000000..6abf38f94 --- /dev/null +++ b/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts @@ -0,0 +1,31 @@ +/// +/// + +function test_cases() { + $('#datetimepicker').datetimepicker(); + $('#datetimepicker').datetimepicker({ + pickDate: false + }); + $('#datetimepicker').datetimepicker({ + pickTime: false + }); + $('#datetimepicker').datetimepicker({ + minDate: '2012-12-31' + }); + + $('#datetimepicker').data("DateTimePicker").setMaxDate('2012-12-31'); + + var startDate = new Date(2012, 1, 20); + var endDate = new Date(2012, 1, 25); + $('#datetimepicker2') + .datetimepicker() + .on("dp.change", function (ev) { + if (ev.date.valueOf() > endDate.valueOf()) { + $('#alert').show().find('strong').text('The start date must be before the end date.'); + } else { + $('#alert').hide(); + startDate = ev.date; + $('#date-start-display').text($('#date-start').data('date')); + } + }); +} \ No newline at end of file diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts new file mode 100644 index 000000000..6f1147cc1 --- /dev/null +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -0,0 +1,100 @@ +// Type definitions for Bootstrap datetimepicker v3 +// Project: http://eonasdan.github.io/bootstrap-datetimepicker +// Definitions by: Jesica N. Fera +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * bootstrap-datetimepicker.js 3.0.0 Copyright (c) 2014 Jonathan Peterson + * Available via the MIT license. + * see: http://eonasdan.github.io/bootstrap-datetimepicker or https://github.com/Eonasdan/bootstrap-datetimepicker for details. + */ + +/// + +declare module BootstrapV3DatetimePicker { + interface DatetimepickerChangeEventObject extends JQueryEventObject { + date: any; + oldDate: any; + } + + interface DatetimepickerEventObject extends JQueryEventObject { + date: any; + } + + interface DatetimepickerIcons { + time?: string; + date?: string; + up?: string; + down?: string; + } + + interface DatetimepickerOptions { + pickDate?: boolean; + pickTime?: boolean; + useMinutes?: boolean; + useSeconds?: boolean; + useCurrent?: boolean; + minuteStepping?: number; + minDate?: any; + maxDate?: any; + showToday?: boolean; + collapse?: boolean; + language?: string; + defaultDate?: string; + disabledDates?: Array; + enabledDates?: Array; + icons?: DatetimepickerIcons; + useStrict?: boolean; + direction?: string; + sideBySide?: boolean; + daysOfWeekDisabled?: Array; + } + + interface Datetimepicker { + setDate(date: any): void; + setMinDate(date: any): void; + setMaxDate(date: any): void; + show(): void; + disable(): void; + enable(): void; + getDate(): void; + } + +} + + +interface JQuery { + + datetimepicker(): JQuery; + datetimepicker(options: BootstrapV3DatetimePicker.DatetimepickerOptions): JQuery; + + off(events: "dp.change", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + off(events: "dp.change", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + + on(events: "dp.change", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + on(events: "dp.change", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + on(events: 'dp.change', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + + off(events: "dp.show", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.show", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.show", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.show", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.show', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + off(events: "dp.hide", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.hide", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.hide", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.hide", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.hide', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + off(events: "dp.error", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.error", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.error", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.error", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.error', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + data(key: 'DateTimePicker'): BootstrapV3DatetimePicker.Datetimepicker; +} \ No newline at end of file diff --git a/chai/chai-assert-tests.ts.tscparams b/chai/chai-assert-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/chai/chai-assert-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index e8e0f0639..d7aee083e 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1232,6 +1232,68 @@ declare module chrome.management { var onEnabled: ManagementEnabledEvent; } +//////////////////// +// Notifications +// https://developer.chrome.com/extensions/notifications +//////////////////// +declare module chrome.notifications { + interface ButtonOptions { + title: string; + iconUrl?: string; + } + + interface ItemOptions { + title: string; + message: string; + } + + interface NotificationOptions { + type?: string; + iconUrl?: string; + title?: string; + message?: string; + contextMessage?: string; + priority?: number; + eventTime?: number; + buttons?: Array; + items?: Array; + progress?: number; + isClickable?: boolean; + } + + interface OnClosed { + addListener(callback: (notificationId: string, byUser: boolean) => void): void; + } + + interface OnClicked { + addListener(callback: (notificationId: string) => void): void; + } + + interface OnButtonClicked { + addListener(callback: (notificationId: string, buttonIndex: number) => void): void; + } + + interface OnPermissionLevelChanged { + addListener(callback: (level: string) => void): void; + } + + interface OnShowSettings { + addListener(callback: Function): void; + } + + export var onClosed: OnClosed; + export var onClicked: OnClicked; + export var onButtonClicked: OnButtonClicked; + export var onPermissionLevelChanged: OnPermissionLevelChanged; + export var onShowSettings: OnShowSettings; + + export function create(notificationId: string, options: NotificationOptions, callback: (notificationId: string) => void): void; + export function update(notificationId: string, options: NotificationOptions, callback: (wasUpdated: boolean) => void): void; + export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void; + export function getAll(callback: (notifications: any) => void): void; + export function getPermissionLevel(callback: (level: string) => void): void; +} + //////////////////// // Omnibox //////////////////// diff --git a/date.format.js/date.format.d.ts b/date.format.js/date.format.d.ts new file mode 100644 index 000000000..249926eae --- /dev/null +++ b/date.format.js/date.format.d.ts @@ -0,0 +1,203 @@ +/****************************************************************************** + Portions Copyright (c) Microsoft Corporation. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + +// Typing for the date.format.js from Steven Levithan +// reproduces "Date" and adds format() - seemed to be the only way ... + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): void; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): void; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): void; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): void; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): void; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): void; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): void; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): void; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): void; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): void; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): void; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): void; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): void; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): void; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): void; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; + + format(mask: string, utc?: boolean) : string; +} + + +declare var Date: { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +}; + +declare function dateFormat(date?: any, mask?: string, utc?: boolean ) : string; diff --git a/expect.js/expect.js.d.ts b/expect.js/expect.js.d.ts index 64c5871b0..21bffb44a 100644 --- a/expect.js/expect.js.d.ts +++ b/expect.js/expect.js.d.ts @@ -17,7 +17,7 @@ declare module Expect { * * @param fn callback to match error string against */ - throwError(fn?: (exception: any) => void): void; + throwError(fn?: (exception: any) => void): void; /** * Assert that the function throws. diff --git a/ix.js/l2o.d.ts b/ix.js/l2o.d.ts index 209c9b675..310e31f01 100644 --- a/ix.js/l2o.d.ts +++ b/ix.js/l2o.d.ts @@ -91,16 +91,16 @@ declare module Ix { comparer?: EqualityComparer): Enumerable; groupBy( keySelector: (item: T) => TKey, - elementSelector: (item: T) => TElement): Grouping; + elementSelector: (item: T) => TElement): Enumerable>; groupBy( - keySelector: (item: T) => TKey): Grouping; + keySelector: (item: T) => TKey): Enumerable>; // if need to set comparer without resultSelector groupBy( keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, _: boolean, - comparer: EqualityComparer): Grouping; + comparer: EqualityComparer): Enumerable>; // if need to set resultSelector without elementSelector groupBy( keySelector: (item: T) => TKey, @@ -112,7 +112,7 @@ declare module Ix { keySelector: (item: T) => TKey, _: boolean, __: boolean, - comparer: EqualityComparer): Grouping; + comparer: EqualityComparer): Enumerable>; groupJoin( inner: Enumerable, diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 45a46dcd0..26048a9dc 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -29,27 +29,6 @@ var funcArr: Function[] = []; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var validOpts: Joi.ValidationOptions = null; - -validOpts = {abortEarly: bool}; -validOpts = {convert: bool}; -validOpts = {allowUnknown: bool}; -validOpts = {skipFunctions: bool}; -validOpts = {stripUnknown: bool}; -validOpts = {language: bool}; - -// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- - -var renOpts: Joi.RenameOptions = null; - -renOpts = {alias: bool}; -renOpts = {multiple: bool}; -renOpts = {override: bool}; - -var validErr: Joi.ValidationError = null; - -// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- - var schema: Joi.Schema = null; var anySchema: Joi.AnySchema = null; @@ -61,9 +40,66 @@ var binSchema: Joi.BinarySchema = null; var dateSchema: Joi.DateSchema = null; var funcSchema: Joi.FunctionSchema = null; var objSchema: Joi.ObjectSchema = null; +var altSchema: Joi.AlternativesSchema = null; var schemaArr: Joi.Schema[] = []; +var ref: Joi.Reference = null; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var validOpts: Joi.ValidationOptions = null; + +validOpts = {abortEarly: bool}; +validOpts = {convert: bool}; +validOpts = {allowUnknown: bool}; +validOpts = {skipFunctions: bool}; +validOpts = {stripUnknown: bool}; +validOpts = {language: bool}; +validOpts = {context: obj}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var renOpts: Joi.RenameOptions = null; + +renOpts = {alias: bool}; +renOpts = {multiple: bool}; +renOpts = {override: bool}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var whenOpts: Joi.WhenOptions = null; + +whenOpts = {is: schema}; +whenOpts = {is: schema, then: schema}; +whenOpts = {is: schema, otherwise: schema}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var refOpts: Joi.ReferenceOptions = null; + +refOpts = {alias: bool}; +refOpts = {multiple: bool}; +refOpts = {override: bool}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var validErr: Joi.ValidationError = null; +var validErrItem: Joi.ValidationErrorItem; + +validErrItem= { + message: str, + type: str, + path: str +}; + +validErrItem = { + message: str, + type: str, + path: str, + options: validOpts +}; + // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- schema = anySchema; @@ -76,6 +112,8 @@ schema = dateSchema; schema = funcSchema; schema = objSchema; +schema = ref; + anySchema = anySchema; anySchema = numSchema; anySchema = strSchema; @@ -99,18 +137,22 @@ schemaMap = { anySchema = Joi.any(); -anySchema.validate(x, (err: Joi.ValidationError, value: any) => { - -}); - module common { anySchema = anySchema.allow(x); + anySchema = anySchema.allow(x, x); + anySchema = anySchema.allow([x, x, x]); anySchema = anySchema.valid(x); + anySchema = anySchema.valid(x, x); + anySchema = anySchema.valid([x, x, x]); anySchema = anySchema.invalid(x); + anySchema = anySchema.invalid(x, x); + anySchema = anySchema.invalid([x, x, x]); + anySchema = anySchema.default(x); anySchema = anySchema.required(); anySchema = anySchema.optional(); + anySchema = anySchema.forbidden(); anySchema = anySchema.description(str); anySchema = anySchema.notes(str); @@ -118,8 +160,16 @@ module common { anySchema = anySchema.tags(str); anySchema = anySchema.tags(strArr); + anySchema = anySchema.meta(obj); + anySchema = anySchema.example(obj); + anySchema = anySchema.unit(str); + anySchema = anySchema.options(validOpts); anySchema = anySchema.strict(); + anySchema = anySchema.concat(x); + + altSchema = anySchema.when(str, whenOpts); + altSchema = anySchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -140,14 +190,23 @@ arrSchema = arrSchema.excludes([numSchema, strSchema]); // - - - - - - - - -module common { - arrSchema = arrSchema.allow(anyArr); - arrSchema = arrSchema.valid(anyArr); - arrSchema = arrSchema.invalid(anyArr); - arrSchema = arrSchema.default(anyArr); +module common_copy_paste { + // use search & replace from any + anySchema = anySchema.allow(x); + anySchema = anySchema.allow(x, x); + anySchema = anySchema.allow([x, x, x]); + anySchema = anySchema.valid(x); + anySchema = anySchema.valid(x, x); + anySchema = anySchema.valid([x, x, x]); + anySchema = anySchema.invalid(x); + anySchema = anySchema.invalid(x, x); + anySchema = anySchema.invalid([x, x, x]); + + anySchema = anySchema.default(x); arrSchema = arrSchema.required(); arrSchema = arrSchema.optional(); + arrSchema = arrSchema.forbidden(); arrSchema = arrSchema.description(str); arrSchema = arrSchema.notes(str); @@ -155,8 +214,16 @@ module common { arrSchema = arrSchema.tags(str); arrSchema = arrSchema.tags(strArr); + arrSchema = arrSchema.meta(obj); + arrSchema = arrSchema.example(obj); + arrSchema = arrSchema.unit(str); + arrSchema = arrSchema.options(validOpts); arrSchema = arrSchema.strict(); + arrSchema = arrSchema.concat(x); + + altSchema = arrSchema.when(str, whenOpts); + altSchema = arrSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -164,14 +231,22 @@ module common { boolSchema = Joi.bool(); boolSchema = Joi.boolean(); -module common { - boolSchema = boolSchema.allow(bool); - boolSchema = boolSchema.valid(bool); - boolSchema = boolSchema.invalid(bool); - boolSchema = boolSchema.default(bool); +module common_copy_paste { + boolSchema = boolSchema.allow(x); + boolSchema = boolSchema.allow(x, x); + boolSchema = boolSchema.allow([x, x, x]); + boolSchema = boolSchema.valid(x); + boolSchema = boolSchema.valid(x, x); + boolSchema = boolSchema.valid([x, x, x]); + boolSchema = boolSchema.invalid(x); + boolSchema = boolSchema.invalid(x, x); + boolSchema = boolSchema.invalid([x, x, x]); + + boolSchema = boolSchema.default(x); boolSchema = boolSchema.required(); boolSchema = boolSchema.optional(); + boolSchema = boolSchema.forbidden(); boolSchema = boolSchema.description(str); boolSchema = boolSchema.notes(str); @@ -179,8 +254,16 @@ module common { boolSchema = boolSchema.tags(str); boolSchema = boolSchema.tags(strArr); + boolSchema = boolSchema.meta(obj); + boolSchema = boolSchema.example(obj); + boolSchema = boolSchema.unit(str); + boolSchema = boolSchema.options(validOpts); boolSchema = boolSchema.strict(); + boolSchema = boolSchema.concat(x); + + altSchema = boolSchema.when(str, whenOpts); + altSchema = boolSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -192,13 +275,21 @@ binSchema = binSchema.max(num); binSchema = binSchema.length(num); module common { - binSchema = binSchema.allow(bin); - binSchema = binSchema.valid(bin); - binSchema = binSchema.invalid(bin); - binSchema = binSchema.default(bin); + binSchema = binSchema.allow(x); + binSchema = binSchema.allow(x, x); + binSchema = binSchema.allow([x, x, x]); + binSchema = binSchema.valid(x); + binSchema = binSchema.valid(x, x); + binSchema = binSchema.valid([x, x, x]); + binSchema = binSchema.invalid(x); + binSchema = binSchema.invalid(x, x); + binSchema = binSchema.invalid([x, x, x]); + + binSchema = binSchema.default(x); binSchema = binSchema.required(); binSchema = binSchema.optional(); + binSchema = binSchema.forbidden(); binSchema = binSchema.description(str); binSchema = binSchema.notes(str); @@ -206,8 +297,16 @@ module common { binSchema = binSchema.tags(str); binSchema = binSchema.tags(strArr); + binSchema = binSchema.meta(obj); + binSchema = binSchema.example(obj); + binSchema = binSchema.unit(str); + binSchema = binSchema.options(validOpts); binSchema = binSchema.strict(); + binSchema = binSchema.concat(x); + + altSchema = binSchema.when(str, whenOpts); + altSchema = binSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -224,23 +323,21 @@ dateSchema = dateSchema.min(num); dateSchema = dateSchema.max(num); module common { - dateSchema = dateSchema.allow(date); - dateSchema = dateSchema.valid(date); - dateSchema = dateSchema.invalid(date); - dateSchema = dateSchema.default(date); - - dateSchema = dateSchema.allow(num); - dateSchema = dateSchema.valid(num); - dateSchema = dateSchema.invalid(num); - dateSchema = dateSchema.default(num); - - dateSchema = dateSchema.allow(str); - dateSchema = dateSchema.valid(str); - dateSchema = dateSchema.invalid(str); - dateSchema = dateSchema.default(str); + dateSchema = dateSchema.allow(x); + dateSchema = dateSchema.allow(x, x); + dateSchema = dateSchema.allow([x, x, x]); + dateSchema = dateSchema.valid(x); + dateSchema = dateSchema.valid(x, x); + dateSchema = dateSchema.valid([x, x, x]); + dateSchema = dateSchema.invalid(x); + dateSchema = dateSchema.invalid(x, x); + dateSchema = dateSchema.invalid([x, x, x]); + + dateSchema = dateSchema.default(x); dateSchema = dateSchema.required(); dateSchema = dateSchema.optional(); + dateSchema = dateSchema.forbidden(); dateSchema = dateSchema.description(str); dateSchema = dateSchema.notes(str); @@ -248,8 +345,16 @@ module common { dateSchema = dateSchema.tags(str); dateSchema = dateSchema.tags(strArr); + dateSchema = dateSchema.meta(obj); + dateSchema = dateSchema.example(obj); + dateSchema = dateSchema.unit(str); + dateSchema = dateSchema.options(validOpts); dateSchema = dateSchema.strict(); + dateSchema = dateSchema.concat(x); + + altSchema = dateSchema.when(str, whenOpts); + altSchema = dateSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -265,13 +370,21 @@ numSchema = numSchema.max(num); numSchema = numSchema.integer(); module common { - numSchema = numSchema.allow(num); - numSchema = numSchema.valid(num); - numSchema = numSchema.invalid(num); - numSchema = numSchema.default(num); + numSchema = numSchema.allow(x); + numSchema = numSchema.allow(x, x); + numSchema = numSchema.allow([x, x, x]); + numSchema = numSchema.valid(x); + numSchema = numSchema.valid(x, x); + numSchema = numSchema.valid([x, x, x]); + numSchema = numSchema.invalid(x); + numSchema = numSchema.invalid(x, x); + numSchema = numSchema.invalid([x, x, x]); + + numSchema = numSchema.default(x); numSchema = numSchema.required(); numSchema = numSchema.optional(); + numSchema = numSchema.forbidden(); numSchema = numSchema.description(str); numSchema = numSchema.notes(str); @@ -279,8 +392,16 @@ module common { numSchema = numSchema.tags(str); numSchema = numSchema.tags(strArr); + numSchema = numSchema.meta(obj); + numSchema = numSchema.example(obj); + numSchema = numSchema.unit(str); + numSchema = numSchema.options(validOpts); numSchema = numSchema.strict(); + numSchema = numSchema.concat(x); + + altSchema = numSchema.when(str, whenOpts); + altSchema = numSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -295,29 +416,48 @@ objSchema = objSchema.min(num); objSchema = objSchema.max(num); objSchema = objSchema.length(num); +objSchema = objSchema.pattern(exp, schema); + +objSchema = objSchema.and(str, str, str); +objSchema = objSchema.and(strArr); + +objSchema = objSchema.or(str, str, str); +objSchema = objSchema.or(strArr); + +objSchema = objSchema.xor(str, str, str); +objSchema = objSchema.xor(strArr); + objSchema = objSchema.with(str, str); objSchema = objSchema.with(str, strArr); objSchema = objSchema.without(str, str); objSchema = objSchema.without(str, strArr); -objSchema = objSchema.xor(str, str, str); -objSchema = objSchema.xor(strArr); - -objSchema = objSchema.or(str, str, str); -objSchema = objSchema.or(strArr); - objSchema = objSchema.rename(str, str); objSchema = objSchema.rename(str, str, renOpts); +objSchema = objSchema.assert(str, schema, str); +objSchema = objSchema.assert(ref, schema, str); + +objSchema = objSchema.unknown(); +objSchema = objSchema.unknown(bool); + module common { - objSchema = objSchema.allow(obj); - objSchema = objSchema.valid(obj); - objSchema = objSchema.invalid(obj); - objSchema = objSchema.default(obj); + objSchema = objSchema.allow(x); + objSchema = objSchema.allow(x, x); + objSchema = objSchema.allow([x, x, x]); + objSchema = objSchema.valid(x); + objSchema = objSchema.valid(x, x); + objSchema = objSchema.valid([x, x, x]); + objSchema = objSchema.invalid(x); + objSchema = objSchema.invalid(x, x); + objSchema = objSchema.invalid([x, x, x]); + + objSchema = objSchema.default(x); objSchema = objSchema.required(); objSchema = objSchema.optional(); + objSchema = objSchema.forbidden(); objSchema = objSchema.description(str); objSchema = objSchema.notes(str); @@ -325,8 +465,16 @@ module common { objSchema = objSchema.tags(str); objSchema = objSchema.tags(strArr); + objSchema = objSchema.meta(obj); + objSchema = objSchema.example(obj); + objSchema = objSchema.unit(str); + objSchema = objSchema.options(validOpts); objSchema = objSchema.strict(); + objSchema = objSchema.concat(x); + + altSchema = objSchema.when(str, whenOpts); + altSchema = objSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -343,35 +491,43 @@ strSchema = strSchema.token(); strSchema = strSchema.email(); strSchema = strSchema.guid(); strSchema = strSchema.isoDate(); +strSchema = strSchema.lowercase(); +strSchema = strSchema.uppercase(); +strSchema = strSchema.trim(); module common { strSchema = strSchema.allow(x); strSchema = strSchema.allow(x, x); - strSchema = strSchema.allow(anyArr); - + strSchema = strSchema.allow([x, x, x]); strSchema = strSchema.valid(x); strSchema = strSchema.valid(x, x); - strSchema = strSchema.valid(anyArr); - + strSchema = strSchema.valid([x, x, x]); strSchema = strSchema.invalid(x); strSchema = strSchema.invalid(x, x); - strSchema = strSchema.invalid(anyArr); + strSchema = strSchema.invalid([x, x, x]); + + strSchema = strSchema.default(x); strSchema = strSchema.required(); - strSchema = strSchema.optional(); + strSchema = strSchema.forbidden(); strSchema = strSchema.description(str); - strSchema = strSchema.notes(str); strSchema = strSchema.notes(strArr); - strSchema = strSchema.tags(str); strSchema = strSchema.tags(strArr); + strSchema = strSchema.meta(obj); + strSchema = strSchema.example(obj); + strSchema = strSchema.unit(str); + strSchema = strSchema.options(validOpts); strSchema = strSchema.strict(); - strSchema = strSchema.default(x); + strSchema = strSchema.concat(x); + + altSchema = strSchema.when(str, whenOpts); + altSchema = strSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -390,6 +546,13 @@ Joi.validate(value, schema, validOpts, (err, value) => { str = err.details[0].message; str = err.details[0].type; }); +Joi.validate(value, schema, (err, value) => { + x = value; + str = err.message; + str = err.details[0].path; + str = err.details[0].message; + str = err.details[0].type; +}); // variant Joi.validate(num, schema, validOpts, (err, value) => { num = value; @@ -401,3 +564,8 @@ Joi.validate(value, {}); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- schema = Joi.compile(obj); + +Joi.assert(obj, schema); + +ref = Joi.ref(str, refOpts); +ref = Joi.ref(str); diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 10bc7225e..57e48a023 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -1,8 +1,10 @@ -// Type definitions for joi v4.0.0 +// Type definitions for joi v4.6.0 // Project: https://github.com/spumko/joi // Definitions by: Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TODO express type of Schema in a type-parameter (.default, .valid, .example etc) + declare module 'joi' { export interface ValidationOptions { @@ -18,6 +20,8 @@ declare module 'joi' { stripUnknown?: boolean; // overrides individual error messages. Defaults to no override ({}). language?: Object + // provides an external data set to be used in references + context?: Object; } export interface RenameOptions { @@ -29,6 +33,20 @@ declare module 'joi' { override?: boolean; } + export interface WhenOptions { + // the required condition joi type. + is: Schema; + // the alternative schema type if the condition is true. Required if otherwise is missing. + then?: Schema; + // the alternative schema type if the condition is false. Required if then is missing + otherwise?: Schema; + } + + export interface ReferenceOptions { + separator?: string; + contextPrefix?: string; + } + export interface ValidationError { message: string; details: ValidationErrorItem[]; @@ -48,12 +66,14 @@ declare module 'joi' { } export interface Schema extends AnySchema { + + } + + export interface Reference extends Schema { + } export interface AnySchema> { - - validate(value: U, options?: ValidationOptions, callback?: (err: ValidationError, value: U) => void): void; - /** * Whitelists a value */ @@ -82,6 +102,11 @@ declare module 'joi' { */ optional(): T; + /** + * Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys. + */ + forbidden(): T; + /** * Annotates the key */ @@ -100,7 +125,22 @@ declare module 'joi' { tags(notes: string[]): T; /** - * Overrides the global validate() options for the current key and any sub-key + * Attaches metadata to the key. + */ + meta(meta: Object): T; + + /** + * Annotates the key with an example value, must be valid. + */ + example(value: any): T; + + /** + * Annotates the key with an unit name. + */ + unit(name: string): T; + + /** + * Overrides the global validate() options for the current key and any sub-key. */ options(options: ValidationOptions): T; @@ -110,9 +150,20 @@ declare module 'joi' { strict(): T; /** - * Sets a default value if the original value is undefined + * Sets a default value if the original value is undefined. */ default(value: any): T; + + /** + * Returns a new type that is the result of adding the rules of one type to another. + */ + concat(schema: T): T; + + /** + * Converts the type into an alternatives type where the conditions are merged into the type definition where: + */ + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; } export interface BooleanSchema extends AnySchema { @@ -187,6 +238,20 @@ declare module 'joi' { */ isoDate(): StringSchema; + /** + * Requires the string value to be all lowercase. If the validation convert option is on (enabled by default), the string will be forced to lowercase. + */ + lowercase(): StringSchema; + + /** + * Requires the string value to be all uppercase. If the validation convert option is on (enabled by default), the string will be forced to uppercase. + */ + uppercase(): StringSchema; + + /** + * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed. + */ + trim(): StringSchema; } export interface ArraySchema extends AnySchema { @@ -240,6 +305,29 @@ declare module 'joi' { */ length(limit: number): ObjectSchema; + /** + * Specify validation rules for unknown keys matching a pattern. + */ + pattern(regex: RegExp, schema: Schema): ObjectSchema; + + /** + * Defines an all-or-nothing relationship between keys where if one of the peers is present, all of them are required as well. + */ + and(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; + and(peers: string[]): ObjectSchema; + + /** + * Defines a relationship between keys where one of the peers is required (and more than one is allowed). + */ + or(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; + or(peers: string[]): ObjectSchema; + + /** + * Defines an exclusive relationship between a set of keys. one of them is required but not at the same time where: + */ + xor(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; + xor(peers: string[]): ObjectSchema; + /** * Requires the presence of other keys whenever the specified key is present. */ @@ -252,22 +340,21 @@ declare module 'joi' { without(key: string, peers: string): ObjectSchema; without(key: string, peers: string[]): ObjectSchema; - /** - * Defines an exclusive relationship between a set of keys. one of them is required but not at the same time where: - */ - xor(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; - xor(peers: string[]): ObjectSchema; - - /** - * Defines a relationship between keys where one of the peers is required (and more than one is allowed). - */ - or(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; - or(peers: string[]): ObjectSchema; - /** * Renames a key to another name (deletes the renamed key). */ rename(from: string, to: string, options?: RenameOptions): ObjectSchema; + + /** + * Verifies an assertion where. + */ + assert(ref: string, schema: Schema, message: string): ObjectSchema; + assert(ref: Reference, schema: Schema, message: string): ObjectSchema; + + /** + * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children). + */ + unknown(allow?:boolean): ObjectSchema; } export interface BinarySchema extends AnySchema { @@ -308,6 +395,12 @@ declare module 'joi' { } + export interface AlternativesSchema extends AnySchema { + try(schemas: Schema[]): AlternativesSchema; + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; + } + // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- /** @@ -368,10 +461,21 @@ declare module 'joi' { */ export function validate(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; + export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; + export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; /** * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). */ export function compile(schema: Object): Schema; + /** + * Validates a value against a schema and throws if validation fails. + */ + export function assert(value: any, schema: Schema): void; + + /** + * Generates a reference to the value of the named key. + */ + export function ref(key:string, options?: ReferenceOptions): Reference; } diff --git a/jquery.dynatree/jquery.dynatree.d.ts b/jquery.dynatree/jquery.dynatree.d.ts index 91425644d..adf8b5399 100644 --- a/jquery.dynatree/jquery.dynatree.d.ts +++ b/jquery.dynatree/jquery.dynatree.d.ts @@ -1,22 +1,23 @@ -// Type definitions for jquery.dynatree 1.2 +// Type definitions for jquery.dynatree 1.2.5 // Project: http://code.google.com/p/dynatree/ // Definitions by: https://github.com/fdecampredon // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// + +declare module JQueryUI { + interface UI { + dynatree: DynatreeNamespace + } +} interface JQuery { dynatree(options?: DynatreeOptions): DynaTree; dynatree(option?: string, ...rest: any[]): any; } -interface JQueryStatic { - ui: { - dynatree: DynatreeNamespace; - }; -} - interface DynaTree { activateKey(key: string): DynaTreeNode; count(): number; @@ -39,7 +40,7 @@ interface DynaTree { renderInvisibleNodes(): void; selectKey(key: string, flag: string): DynaTreeNode; serializeArray(stopOnParents: boolean): any[]; - toDict(): any; + toDict(includeRoot?: boolean): any; visit(fn: (node: DynaTreeNode) =>boolean, includeRoot: boolean): void; } @@ -77,6 +78,7 @@ interface DynaTreeNode { makeVisible(): boolean; move(targetNode: DynaTreeNode, mode: string): boolean; reload(force: boolean): void; + reloadChildren(callback?: (node: DynaTreeNode, isOk: boolean) => any): void; remove(): void; removeChildren(): void; render(useEffects: boolean, includeInvisible: boolean): void; @@ -177,7 +179,7 @@ interface DynaTreeDataModel { interface DynaTreeDNDOptions { autoExpandMS?: number; // Expand nodes after n milliseconds of hovering. preventVoidMoves?: boolean; // Prevent dropping nodes 'before self', etc. - + revert: boolean; // true: slide helper back to source if drop is rejected // Make tree nodes draggable: onDragStart?: (sourceNode: any) =>void; // Callback(sourceNode), return true, to enable dnd @@ -239,4 +241,4 @@ interface DynatreeNamespace { getNode(element: HTMLElement): DynaTreeNode; getPersistData(cookieId: string, cookieOpts: DynaTreeCookieOptions): any; version: number; -} +} \ No newline at end of file diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 61b15b20b..63f02bb3c 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -6,7 +6,7 @@ function test_add() { $('li').add('p').css('background-color', 'red'); $('li').add(document.getElementsByTagName('p')[0]) - .css('background-color', 'red'); + .css('background-coailor', 'red'); $('li').add('

new paragraph

') .css('background-color', 'red'); $("div").css("border", "2px solid red") @@ -86,6 +86,9 @@ function test_ajax() { success: function (data) { $('.result').html(data); alert('Load was performed.'); + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('Load failed. responseJSON=' + jqXHR.responseJSON); } }); var _super = jQuery.ajaxSettings.xhr; diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 62b1a3fea..213d500b2 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -80,7 +80,7 @@ interface JQueryAjaxSettings { /** * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrow: string): any; + error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; /** * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. */ @@ -172,6 +172,10 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. */ then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => void, failCallback: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; + /* + * Property containing the parsed response if the response Content-Type is json + */ + responseJSON?: any; } /** diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index a2d91032a..54f0fe4f0 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -474,7 +474,7 @@ declare module L { * positions. * Default value: 'topright'. */ - position: string; + position?: string; } } @@ -773,20 +773,20 @@ declare module L { /** * Create a layer group, optionally given an initial set of layers. */ - function featureGroup(layers?: ILayer[]): FeatureGroup; + function featureGroup(layers?: T[]): FeatureGroup; - export class FeatureGroup extends LayerGroup implements ILayer, IEventPowered { + export class FeatureGroup extends LayerGroup implements ILayer, IEventPowered> { /** * Create a layer group, optionally given an initial set of layers. */ - constructor(layers?: ILayer[]); + constructor(layers?: T[]); /** * Binds a popup with a particular HTML content to a click on any layer from the * group that has a bindPopup method. */ - bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup; + bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup; /** * Returns the LatLngBounds of the Feature Group (created from bounds and coordinates @@ -797,17 +797,17 @@ declare module L { /** * Sets the given path options to each layer of the group that has a setStyle method. */ - setStyle(style: PathOptions): FeatureGroup; + setStyle(style: PathOptions): FeatureGroup; /** * Brings the layer group to the top of all other layers. */ - bringToFront(): FeatureGroup; + bringToFront(): FeatureGroup; /** * Brings the layer group to the bottom of all other layers. */ - bringToBack(): FeatureGroup; + bringToBack(): FeatureGroup; //////////// //////////// @@ -826,20 +826,20 @@ declare module L { //////////////// //////////////// - addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; + addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; hasEventListeners(type: string): boolean; - fireEvent(type: string, data?: any): FeatureGroup; - on(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - once(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - off(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; - fire(type: string, data?: any): FeatureGroup; - addEventListener(eventMap: any, context?: any): FeatureGroup; - removeEventListener(eventMap?: any, context?: any): FeatureGroup; - clearAllEventListeners(): FeatureGroup; - on(eventMap: any, context?: any): FeatureGroup; - off(eventMap?: any, context?: any): FeatureGroup; + fireEvent(type: string, data?: any): FeatureGroup; + on(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + once(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + off(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; + fire(type: string, data?: any): FeatureGroup; + addEventListener(eventMap: any, context?: any): FeatureGroup; + removeEventListener(eventMap?: any, context?: any): FeatureGroup; + clearAllEventListeners(): FeatureGroup; + on(eventMap: any, context?: any): FeatureGroup; + off(eventMap?: any, context?: any): FeatureGroup; } } @@ -882,7 +882,7 @@ declare module L { */ function geoJson(geojson?: any, options?: GeoJSONOptions): GeoJSON; - export class GeoJSON extends FeatureGroup { + export class GeoJSON extends FeatureGroup { /** * Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format @@ -1539,60 +1539,60 @@ declare module L { /** * Create a layer group, optionally given an initial set of layers. */ - function layerGroup(layers?: ILayer[]): LayerGroup; + function layerGroup(layers?: T[]): LayerGroup; - export class LayerGroup extends Class implements ILayer { + export class LayerGroup extends Class implements ILayer { /** * Create a layer group, optionally given an initial set of layers. */ - constructor(layers?: ILayer[]); + constructor(layers?: T[]); /** * Adds the group of layers to the map. */ - addTo(map: Map): LayerGroup; + addTo(map: Map): LayerGroup; /** * Adds a given layer to the group. */ - addLayer(layer: ILayer): LayerGroup; + addLayer(layer: T): LayerGroup; /** * Removes a given layer from the group. */ - removeLayer(layer: ILayer): LayerGroup; + removeLayer(layer: T): LayerGroup; /** * Removes a given layer of the given id from the group. */ - removeLayer(id: string): LayerGroup; + removeLayer(id: string): LayerGroup; /** * Returns true if the given layer is currently added to the group. */ - hasLayer(layer: ILayer): boolean; + hasLayer(layer: T): boolean; /** * Returns the layer with the given id. */ - getLayer(id: string): ILayer; + getLayer(id: string): T; /** * Returns an array of all the layers added to the group. */ - getLayers(): ILayer[]; + getLayers(): T[]; /** * Removes all the layers from the group. */ - clearLayers(): LayerGroup; + clearLayers(): LayerGroup; /** * Iterates over the layers of the group, optionally specifying context of * the iterator function. */ - eachLayer(fn: (layer: ILayer) => void, context?: any): LayerGroup; + eachLayer(fn: (layer: T) => void, context?: any): LayerGroup; /** * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection). @@ -2794,7 +2794,7 @@ declare module L { */ function multiPolygon(latlngs: LatLng[][], options?: PolylineOptions): MultiPolygon; - export class MultiPolygon extends FeatureGroup { + export class MultiPolygon extends FeatureGroup { /** * Instantiates a multi-polyline object given an array of latlngs arrays (one @@ -2829,7 +2829,7 @@ declare module L { */ function multiPolyline(latlngs: LatLng[][], options?: PolylineOptions): MultiPolyline; - export class MultiPolyline extends FeatureGroup { + export class MultiPolyline extends FeatureGroup { /** * Instantiates a multi-polyline object given an array of arrays of geographical @@ -3655,27 +3655,27 @@ declare module L { } } - export interface TileLayerFactory { + export interface TileLayerFactory { /** * Instantiates a tile layer object given a URL template and optionally an options * object. */ - (urlTemplate: string, options?: TileLayerOptions): TileLayer; + (urlTemplate: string, options?: TileLayerOptions): TileLayer; /** * Instantiates a WMS tile layer object given a base URL of the WMS service and * a WMS parameters/options object. */ - wms(baseUrl: string, options: WMSOptions): L.TileLayer.WMS; + wms(baseUrl: string, options: WMSOptions): L.TileLayer.WMS; /** * Instantiates a Canvas tile layer object given an options object (optionally). */ - canvas(options?: TileLayerOptions): L.TileLayer.Canvas; + canvas(options?: TileLayerOptions): L.TileLayer.Canvas; } - - export var tileLayer: TileLayerFactory; + + export var tileLayer: TileLayerFactory; } declare module L { diff --git a/microsoft-live-connect/microsoft-live-connect.d.ts b/microsoft-live-connect/microsoft-live-connect.d.ts index 04ff3ef79..860a31df3 100644 --- a/microsoft-live-connect/microsoft-live-connect.d.ts +++ b/microsoft-live-connect/microsoft-live-connect.d.ts @@ -1,4 +1,5 @@ /// +/// // Type definitions for Microsoft Live Connect v5.0. // Project: http://msdn.microsoft.com/en-us/library/live/hh243643.aspx // Definitions by: John Vilk diff --git a/mixpanel/mixpanel-tests.ts b/mixpanel/mixpanel-tests.ts new file mode 100644 index 000000000..a9cf296c3 --- /dev/null +++ b/mixpanel/mixpanel-tests.ts @@ -0,0 +1,70 @@ +/// +function mixpanel_base() +{ + mixpanel.init("new token", { your: "config" }, "library_name"); + + mixpanel.push(['register', { a: 'b' }]); + + mixpanel.disable(['my_event']); + + mixpanel.track("Registered", {"Gender": "Male", "Age": 21}); + + mixpanel.track_links("#nav", "Clicked Nav Link"); + + mixpanel.track_forms("#register", "Created Account"); + + mixpanel.register({device: 'android', version: '4.0.1'}); + + mixpanel.register_once({device: 'android', version: '4.0.1'}); + + mixpanel.unregister('device'); + + mixpanel.identify('234234sdfdsf'); + + mixpanel.get_distinct_id(); + + mixpanel.alias('w3erwfsdf', '234234sdfdsf'); + + mixpanel.set_config({test: true}); + + mixpanel.get_config(); + + mixpanel.get_property('device'); +} + +function mixpanel_people() +{ + mixpanel.people.set('gender', 'm'); + mixpanel.people.set({ + 'Company': 'Acme', + 'Plan': 'Premium', + 'Upgrade date': new Date() + }); + + mixpanel.people.set_once('First Login Date', new Date()); + mixpanel.people.set_once({ + 'First Login Date': new Date(), + 'Starting Plan': 'Premium' + }); + + mixpanel.people.increment('page_views', 1); + mixpanel.people.increment('page_views'); + mixpanel.people.increment('credits_left', -1); + mixpanel.people.increment({ + counter1: 1, + counter2: 1 + }); + + mixpanel.people.append('pages_visited', 'homepage'); + mixpanel.people.append({ + list1: 'bob', + list2: 123 + }); + + mixpanel.people.track_charge(50); + mixpanel.people.track_charge(30.50, {'$time': new Date('jan 1 2012')}); + + mixpanel.people.clear_charges(); + + mixpanel.people.delete_user(); +} diff --git a/mixpanel/mixpanel.d.ts b/mixpanel/mixpanel.d.ts new file mode 100644 index 000000000..9d1ef9527 --- /dev/null +++ b/mixpanel/mixpanel.d.ts @@ -0,0 +1,71 @@ +// Type definitions for Mixpanel +// Project: https://mixpanel.com/ (https://github.com/mixpanel/mixpanel-js) +// Definitions by: Knut Eirik Leira Hjelle +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Mixpanel +{ + people:Mixpanel.People; + + init(token:string, config:{[index:string]:any}, libraryName:string):Mixpanel; + + push(item:any[]):void; + + disable(events?:string[]):void; + + track(eventName:string, params?:{[index:string]:any}, callback?:() => void):void; + + track_links(querySelector:string, eventName:string, params?:{[index:string]:any}):void; + + track_forms(querySelector:string, eventName:string, params?:{[index:string]:any}):void; + + register(params:{[index:string]:any}, days?:number):void; + + register_once(params:{[index:string]:any}, defaultValue?:string, days?:number):void; + + unregister(propertyName:string):void; + + identify(id:string):void; + + get_distinct_id():string; + + alias(alias:string, currentId?:string):void; + + set_config(config:{[index:string]:any}):void; + + get_config():{[index:string]:any}; + + get_property(propertyName:string):any; +} + +declare module Mixpanel +{ + interface People + { + set(keys:{[index:string]:any}, callback?:() => void):void; + + set(key:string, value:any, callback?:() => void):void; + + set_once(keys:{[index:string]:any}, callback?:() => void):void; + + set_once(key:string, value:any, callback?:() => void):void; + + increment(key:string):void; + + increment(keys:{[index:string]:number}):void; + + increment(key:string, value:number):void; + + append(keys:{[index:string]:any}):void; + + append(key:string, value:any):void; + + track_charge(amount:number, params?:{[index:string]:any}, callback?:() => void):void; + + clear_charges():void; + + delete_user():void; + } +} + +declare var mixpanel:Mixpanel; \ No newline at end of file diff --git a/nock/nock-tests.ts b/nock/nock-tests.ts index b3b68dd20..f3c166aa1 100644 --- a/nock/nock-tests.ts +++ b/nock/nock-tests.ts @@ -7,6 +7,7 @@ var str: string; var bool: boolean; var data: string; var num: number; +var obj: {}; var value: any; var regex: RegExp; var options: nock.Options; @@ -29,7 +30,9 @@ inst = inst.intercept(str, str, str, value); inst = inst.reply(num); inst = inst.reply(num, str); + inst = inst.reply(num, str, headers); +inst = inst.reply(num, obj, headers); inst = inst.reply(num, (uri: string, body: string) => { return str; }); diff --git a/nock/nock.d.ts b/nock/nock.d.ts index 9c8aaac2e..40b728d49 100644 --- a/nock/nock.d.ts +++ b/nock/nock.d.ts @@ -23,6 +23,7 @@ declare module "nock" { intercept(path: string, verb: string, body?: string, options?: any): Scope; reply(responseCode: number, body?: string, headers?: Object): Scope; + reply(responseCode: number, body?: Object, headers?: Object): Scope; reply(responseCode: number, callback: (uri: string, body: string) => string, headers?: Object): Scope; replyWithFile(responseCode: number, fileName: string): Scope; diff --git a/parsimmon/parsimmon-tests.ts b/parsimmon/parsimmon-tests.ts index 16d1510b5..d1f3d4e6b 100644 --- a/parsimmon/parsimmon-tests.ts +++ b/parsimmon/parsimmon-tests.ts @@ -55,6 +55,11 @@ foo = fooPar.parse(str); fooPar = fooPar.or(fooPar); anyPar = fooPar.or(barPar); +barPar = fooPar.chain((f) => { + foo = f; + return barPar; +}); + barPar = fooPar.then((f) => { foo = f; return barPar; @@ -82,6 +87,8 @@ fooArrPar = fooPar.atLeast(num); fooMarkPar = fooPar.mark(); +fooPar = fooPar.desc(str); + // -- -- -- -- -- -- -- -- -- -- -- -- -- strPar = P.string(str); @@ -92,6 +99,10 @@ fooPar = P.succeed(foo); fooArrPar = P.seq(fooPar, fooPar); anyArrPar = P.seq(barPar, fooPar, numPar); +fooPar = P.alt(fooPar, fooPar); +anyPar = P.alt(barPar, fooPar, numPar); + + fooPar = P.lazy(() => { return fooPar; }); @@ -112,5 +123,5 @@ strPar = P.optWhitespace; strPar = P.any; strPar = P.all; -strPar = P.eof; -numPar = P.index; \ No newline at end of file +voidPar = P.eof; +numPar = P.index; diff --git a/parsimmon/parsimmon.d.ts b/parsimmon/parsimmon.d.ts index 435ea285a..2bf24cba7 100644 --- a/parsimmon/parsimmon.d.ts +++ b/parsimmon/parsimmon.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Parsimmon 0.3.0 +// Type definitions for Parsimmon 0.4.0 // Project: https://github.com/jayferd/parsimmon // Definitions by: Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -24,6 +24,10 @@ declare module 'parsimmon' { */ or(otherParser: Parser): Parser; or(otherParser: Parser): Parser; + /* + returns a new parser which tries parser, and on success calls the given function with the result of the parse, which is expected to return another parser, which will be tried next + */ + chain(next: (result: T) => Parser): Parser; /* returns a new parser which tries parser, and on success calls the given function with the result of the parse, which is expected to return another parser. */ @@ -65,9 +69,11 @@ declare module 'parsimmon' { */ atLeast(n: number): Parser; /* - yields an object with start, value, and end keys, where value is the original value yielded by the parser, and start and end are the indices in the stream that contain the parsed text. + returns a new parser whose failure message is the passed description. */ mark(): Parser>; + + desc(description: string): Parser; } /* is a parser that expects to find "my-string", and will yield the same. @@ -87,12 +93,20 @@ declare module 'parsimmon' { /* accepts a variable number of parsers that it expects to find in order, yielding an array of the results. */ + export function seq(...parsers: Parser[]): Parser; export function seq(...parsers: Parser[]): Parser; + /* + accepts a variable number of parsers, and yields the value of the first one that succeeds, backtracking in between. + */ + export function alt(...parsers: Parser[]): Parser; + export function alt(...parsers: Parser[]): Parser; + /* accepts a function that returns a parser, which is evaluated the first time the parser is used. This is useful for referencing parsers that haven't yet been defined. */ export function lazy(f: () => Parser): Parser; + export function lazy(description: string, f: () => Parser): Parser; /* fail paring with a message @@ -135,7 +149,7 @@ declare module 'parsimmon' { /* expects the end of the stream. */ - export var eof: Parser; + export var eof: Parser; /* is a parser that yields the current index of the parse. */ diff --git a/purl/purl.d.ts b/purl/purl.d.ts index e937a68f4..00312595e 100644 --- a/purl/purl.d.ts +++ b/purl/purl.d.ts @@ -48,3 +48,7 @@ declare function purl(): purl.Url; * @param someUrl the url to be parsed */ declare function purl(someUrl: string): purl.Url; + +declare module "purl" { + export = purl; +} diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 6b69fb228..56ce130f0 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -26,7 +26,7 @@ Q.delay("asdf", 1000).then(x => x.length); var eventualAdd = Q.promised((a?: number, b?: number) => a + b); eventualAdd(Q(1), Q(2)).then(x => x.toExponential()); -var eventually = function (eventually) { +var eventually = function (eventually: any) { return Q.delay(eventually, 1000); }; @@ -38,7 +38,7 @@ Q.when(x, function (x) { Q.all([ eventually(10), eventually(20) -]).spread(function (x, y) { +]).spread(function (x: any, y: any) { console.log(x, y); }); @@ -97,7 +97,7 @@ Q.when(Q(8), num => num + "!").then(str => str.split(',')); declare function saveToDisk(): Q.Promise; declare function saveToCloud(): Q.Promise; -Q.allSettled([saveToDisk(), saveToCloud()]).spread(function (disk, cloud) { +Q.allSettled([saveToDisk(), saveToCloud()]).spread(function (disk: any, cloud: any) { console.log("saved to disk:", disk.state === "fulfilled"); console.log("saved to cloud:", cloud.state === "fulfilled"); @@ -115,3 +115,5 @@ var nodeStyle = (input: string, cb: Function) => { Q.nfapply(nodeStyle, ["foo"]).done((result: string) => {}); Q.nfcall(nodeStyle, "foo").done((result: string) => {}); +Q.denodeify(nodeStyle)('foo').done((result: string) => {}); +Q.nfbind(nodeStyle)('foo').done((result: string) => {}); \ No newline at end of file diff --git a/q/Q-tests.ts.tscparams b/q/Q-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/q/Q-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/q/Q.d.ts b/q/Q.d.ts index 65b2b8223..af3e8bea0 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -207,6 +207,7 @@ declare module Q { export function invoke(obj: any, functionName: string, ...args: any[]): Promise; export function mcall(obj: any, functionName: string, ...args: any[]): Promise; + export function denodeify(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; export function nfbind(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; export function nfcall(nodeFunction: Function, ...args: any[]): Promise; export function nfapply(nodeFunction: Function, args: any[]): Promise; diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index b7810f467..9e66b9647 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -689,8 +689,8 @@ declare module Slick { topPanelHeight?: number; } - export interface DataProvider { - getItem(index: number): SlickData; + export interface DataProvider { + getItem(index: number): T; getLength(): number; } @@ -705,7 +705,7 @@ declare module Slick { * The grid also provides two helper methods to simplify development - getSelectedRows() and setSelectedRows(rowsArray), as well as an onSelectedRowsChanged event. * SlickGrid includes two pre-made selection models - Slick.CellSelectionModel and Slick.RowSelectionModel, but you can easily write a custom one. **/ - export class SelectionModel { + export class SelectionModel { /** * An initializer function that will be called with an instance of the grid whenever a selection model is registered with setSelectionModel. The selection model can use this to initialize its state and subscribe to grid events. **/ @@ -740,12 +740,12 @@ declare module Slick { options: GridOptions); constructor( container: string, - data: DataProvider, + data: DataProvider, columns: Column[], options: GridOptions); constructor( container: HTMLElement, - data: DataProvider, + data: DataProvider, columns: Column[], options: GridOptions); @@ -779,11 +779,18 @@ declare module Slick { /** * Sets a new source for databinding and removes all rendered rows. Note that this doesn't render the new rows - you can follow it with a call to render() to do that. - * @param newData New databinding source. This can either be a regular JavaScript array or a custom object exposing getItem(index) and getLength() functions. + * @param newData New databinding source using a regular JavaScript array.. * @param scrollToTop If true, the grid will reset the vertical scroll position to the top of the grid. **/ public setData(newData: T[], scrollToTop: boolean): void; + /** + * Sets a new source for databinding and removes all rendered rows. Note that this doesn't render the new rows - you can follow it with a call to render() to do that. + * @param newData New databinding source using a custom object exposing getItem(index) and getLength() functions. + * @param scrollToTop If true, the grid will reset the vertical scroll position to the top of the grid. + **/ + public setData(newData: DataProvider, scrollToTop: boolean): void; + /** * Returns the size of the databinding source. * @return @@ -1478,7 +1485,7 @@ declare module Slick { * Item -> Data by index * Row -> Data by row **/ - export class DataView implements DataProvider { + export class DataView implements DataProvider { constructor(options?: DataViewOptions); @@ -1548,7 +1555,7 @@ declare module Slick { public syncGridCellCssStyles(grid: Grid, key: string): void; public getLength(): number; - public getItem(index: number): SlickData; + public getItem(index: number): T; public getItemMetadata(): void; public onRowCountChanged: Slick.Event; diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 2b8e95c35..8bf65f2e7 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -18,8 +18,6 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// - /** * Defines an Element object. **/ @@ -31,11 +29,6 @@ interface Element { * Utility class for easy access to operations on application folders **/ interface IOHelper { - /** - * Instance of the currently wrapped application folder - **/ - folder: Windows.Storage.StorageFolder; - /** * Determines whether the specified file exists in the folder. * @param filename The name of the file. @@ -1219,7 +1212,7 @@ declare module WinJS { /** * Provides a mechanism to schedule work to be done on a value that has not yet been computed. It is an abstraction for managing interactions with asynchronous APIs. For more information about asynchronous programming, see Asynchronous programming. For more information about promises in JavaScript, see Asynchronous programming in JavaScript. For more information about using promises, see the WinJS Promise sample. **/ - class Promise implements Windows.Foundation.IPromise { + class Promise { //#region Constructors /** @@ -1316,7 +1309,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => Windows.Foundation.IPromise, onError?: (error: any) => Windows.Foundation.IPromise, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => Promise, onError?: (error: any) => Promise, onProgress?: (progress: any) => void): Promise; /** * Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. For more information about the differences between then and done, see the following topics: Quickstart: using promises in JavaScript How to handle errors when using promises in JavaScript Chaining promises in JavaScript. @@ -1325,7 +1318,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => Windows.Foundation.IPromise, onError?: (error: any) => U, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => Promise, onError?: (error: any) => U, onProgress?: (progress: any) => void): Promise; /** * Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. For more information about the differences between then and done, see the following topics: Quickstart: using promises in JavaScript How to handle errors when using promises in JavaScript Chaining promises in JavaScript. @@ -1334,7 +1327,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => U, onError?: (error: any) => Windows.Foundation.IPromise, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => U, onError?: (error: any) => Promise, onProgress?: (progress: any) => void): Promise; /** * Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. For more information about the differences between then and done, see the following topics: Quickstart: using promises in JavaScript How to handle errors when using promises in JavaScript Chaining promises in JavaScript. @@ -1343,7 +1336,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => U, onError?: (error: any) => U, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => U, onError?: (error: any) => U, onProgress?: (progress: any) => void): Promise; /** * Performs an operation on all the input promises and returns a promise that has the shape of the input and contains the result of the operation that has been performed on each input. @@ -6379,7 +6372,7 @@ declare module WinJS.UI { * Specifies whether suggestions based on local files are automatically displayed in the search pane, and defines the criteria that Windows uses to locate and filter these suggestions. * @param settings The new settings for local content suggestions. **/ - setLocalContentSuggestionSettings(settings: Windows.ApplicationModel.Search.LocalContentSuggestionSettings): void; + setLocalContentSuggestionSettings(settings: any): void; //#endregion Methods @@ -6672,7 +6665,7 @@ declare module WinJS.UI { * @param query The IStorageQueryResultBase that the StorageDataSource obtains its items from. Instead of IStorageQueryResultBase, you can also pass one of these string values: Music, Pictures, Videos, Documents. * @param options The set of properties and values to apply to the new StorageDataSource. Properties on this object may include: mode , requestedThumbnailSize , thumbnailOptions , synchronous . **/ - constructor(query: Windows.Storage.Search.IStorageQueryResultBase, options?: any); + constructor(query: any, options?: any); //#endregion Constructors diff --git a/xml2js/xml2js-tests.ts b/xml2js/xml2js-tests.ts new file mode 100644 index 000000000..3e3fbb661 --- /dev/null +++ b/xml2js/xml2js-tests.ts @@ -0,0 +1,7 @@ +/// + +import xml2js = require('xml2js'); + +xml2js.parseString("Hello xml2js!", (err: any, result: any) => { }); + +xml2js.parseString("Hello xml2js!", {trim: true}, (err: any, result: any) => { }); diff --git a/xml2js/xml2js.d.ts b/xml2js/xml2js.d.ts new file mode 100644 index 000000000..2b5aabc4d --- /dev/null +++ b/xml2js/xml2js.d.ts @@ -0,0 +1,36 @@ +// Type definitions for node-xml2js +// Project: https://github.com/Leonidas-from-XIV/node-xml2js +// Definitions by: Michel Salib +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'xml2js' { + + export = xml2js; + + module xml2js { + function parseString(xml:string, callback: (err: any, result:any) => void): void; + function parseString(xml:string, options: Options, callback: (err: any, result:any) => void): void; + + interface Options { + attrkey?: string; + charkey?: string; + explicitCharkey?: boolean; + trim?: boolean; + normalizeTags?: boolean; + normalize?: boolean; + explicitRoot?: boolean; + emptyTag?: any; + explicitArray?: boolean; + ignoreAttrs?: boolean; + mergeAttrs?: boolean; + validator?: Function; + xmlns?: boolean; + explicitChildren?: boolean; + charsAsChildren?: boolean; + async?: boolean; + strict?: boolean; + attrNameProcessors?: (name: string) => string; + tagNameProcessors?: (name: string) => string; + } + } +}