From 83993bac9533e17f7a469aae02f79f7e68decb7a Mon Sep 17 00:00:00 2001 From: kimamula Date: Wed, 30 Sep 2015 00:26:52 +0900 Subject: [PATCH 01/20] update jQuery.append, prepend, before and after --- jquery/jquery-tests.ts | 17 ++++++++++++++--- jquery/jquery.d.ts | 16 ++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 1f723fde32..b9e835ebc7 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -41,7 +41,7 @@ function test_addClass() { function test_after() { $('.inner').after('

Test

'); - $('
').after('

'); + $('
').after('

').after(document.createDocumentFragment()); $('
').after('

').addClass('foo') .filter('p').attr('id', 'bar').html('hello') .end() @@ -504,7 +504,7 @@ function test_toggle() { function test_append() { $('.inner').append('

Test

'); - $('.container').append($('h2')); + $('.container').append($('h2')).append(document.createDocumentFragment()); var $newdiv1 = $('
'), newdiv2 = document.createElement('div'), @@ -554,7 +554,7 @@ function test_attributeSelectors() { function test_before() { $('.inner').before('

Test

'); - $('.container').before($('h2')); + $('.container').before($('h2')).before(document.createDocumentFragment()); $("
").before("

"); var $newdiv1 = $('
'), newdiv2 = document.createElement('div'), @@ -941,6 +941,17 @@ function test_clone() { .clone()); } +function test_prepend() { + $('.inner').prepend('

Test

'); + $('.container').prepend($('h2')).prepend(document.createDocumentFragment()); + + var $newdiv1 = $('
'), + newdiv2 = document.createElement('div'), + existingdiv1 = document.getElementById('foo'); + + $('body').prepend($newdiv1, [newdiv2, existingdiv1]); +} + function test_prependTo() { $("

Test

").prependTo(".inner"); $("h2").prependTo($(".container")); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 3641af8503..8f99ce3d5d 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -2579,10 +2579,10 @@ interface JQuery { /** * Insert content, specified by the parameter, after each element in the set of matched elements. * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. + * param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. */ - after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, after each element in the set of matched elements. * @@ -2593,10 +2593,10 @@ interface JQuery { /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. + * param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. */ - append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. * @@ -2614,10 +2614,10 @@ interface JQuery { /** * Insert content, specified by the parameter, before each element in the set of matched elements. * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. + * param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. */ - before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. * @@ -2662,10 +2662,10 @@ interface JQuery { /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. + * param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. */ - prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; + prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. * From 696537ab6effc07dc535b841cdfb2ca765e78525 Mon Sep 17 00:00:00 2001 From: Travis Hill Date: Wed, 22 Jun 2016 15:39:10 -0400 Subject: [PATCH 02/20] Knex - Added more definitions Added additional overloads for the Join interface and extra description for the callback function, including a description of the parameter passed to it, which is an instance of JoinClause. Therefore, also added the JoinClause interface description. Finally, added two new method overloads for Where. --- knex/knex.d.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/knex/knex.d.ts b/knex/knex.d.ts index 70d8cce8cb..74ea935911 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -164,17 +164,30 @@ declare module "knex" { interface Join { (raw: Raw): QueryBuilder; - (tableName: string, callback: Function): QueryBuilder; + (tableName: string, callback: (joinClause: JoinClause) => any): QueryBuilder; + (tableName: string, columns: {[key: string]: string|Raw}): QueryBuilder; + (tableName: string, raw: Raw): QueryBuilder; (tableName: string, column1: string, column2: string): QueryBuilder; (tableName: string, column1: string, raw: Raw): QueryBuilder; (tableName: string, column1: string, operator: string, column2: string): QueryBuilder; } + interface JoinClause { + on(raw: Raw): JoinClause; + on(callback: Function): JoinClause; + on(columns: {[key: string]: string|Raw}): JoinClause; + on(column1: string, column2: string): JoinClause; + on(column1: string, raw: Raw): JoinClause; + on(column1: string, operator: string, column2: string): JoinClause; + } + interface JoinRaw { (tableName: string, binding?: Value): QueryBuilder; } interface Where extends WhereRaw, WhereWrapped, WhereNull { + (raw: Raw): QueryBuilder; + (callback: (queryBuilder: QueryBuilder) => any): QueryBuilder; (object: Object): QueryBuilder; (columnName: string, value: Value): QueryBuilder; (columnName: string, operator: string, value: Value): QueryBuilder; From 0c2447dc9bd44504e3901ca834e1e99cf13d9b9d Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Mon, 27 Jun 2016 12:32:07 -0700 Subject: [PATCH 03/20] add gregorian-calendar type definitions --- .../gregorian-calendar-tests.ts | 14 + gregorian-calendar/gregorian-calendar.d.ts | 274 ++++++++++++++++++ 2 files changed, 288 insertions(+) create mode 100644 gregorian-calendar/gregorian-calendar-tests.ts create mode 100644 gregorian-calendar/gregorian-calendar.d.ts diff --git a/gregorian-calendar/gregorian-calendar-tests.ts b/gregorian-calendar/gregorian-calendar-tests.ts new file mode 100644 index 0000000000..d364e00fd2 --- /dev/null +++ b/gregorian-calendar/gregorian-calendar-tests.ts @@ -0,0 +1,14 @@ +/// + +import GregorianCalendar = require('gregorian-calendar'); +import GregorianCalendarFormat = require('gregorian-calendar-format'); + + +let cal = new GregorianCalendar(); +cal.set(2016, 7, 27, 0, 0, 0, 0); + +let fmt = new GregorianCalendarFormat('yyyy-MM'); + +let calAsStr = fmt.format(cal); +console.log(calAsStr); + diff --git a/gregorian-calendar/gregorian-calendar.d.ts b/gregorian-calendar/gregorian-calendar.d.ts new file mode 100644 index 0000000000..0bb2ffa934 --- /dev/null +++ b/gregorian-calendar/gregorian-calendar.d.ts @@ -0,0 +1,274 @@ +// Type definitions for gregorian-calendar v4.1.4 +// Project: https://github.com/yiminghe/gregorian-calendar +// Definitions by: Charlie Arnold +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare module 'gregorian-calendar' { + + class GregorianCalendar { + + constructor(locale?: Object); + + /** + * same as call setYear, setMonth, setDayOfMonth .... + */ + set(year: Number, month: Number, dayOfMonth: Number, + hourOfDay: Number, minutes: Number, seconds: Number, + milliseconds: Number): void; + + /** + * set absolute time for current instance + */ + setTime(time: Number): void; + + /** + * get absolute time for current instance + */ + getTime(): Number; + + /** + * set current date instance's timezone offset (in minutes) + */ + setTimezoneOffset(timezoneOffset: Number): void + + /** + * current date instance's timezone offset (in minutes) + */ + getTimezoneOffset(): Number; + + /** + * set the year of the given calendar field. + */ + setYear(year: Number): void; + + /** + * Returns the year of the given calendar field. + */ + getYear(): Number; + + /** + * set the month of the given calendar field. January is 0, you can use enum + */ + setMonth(month: Number): void; + + /** + * set the month of the given calendar field without influence month. + * 2015-09-29 -> setMonth(2) -> 2015-03-01 + * 2015-09-29 -> rollSetMonth(2) -> 2015-02-28 + */ + rollSetMonth(month: Number): void; + + /** + * Returns the month of the given calendar field. + */ + getMonth(): Number; + + /** + * set the day of month of the given calendar field. + */ + setDayOfMonth(day: Number): void; + + /** + * Returns the day of month of the given calendar field. + */ + getDayOfMonth(): Number; + + + /** + * set the hour of day for the given calendar field. + */ + setHourOfDay(hour: Number): void; + + /** + * Returns the hour of day for the given calendar field. + */ + getHourOfDay(): Number + + /** + * set the minute of the given calendar field. + */ + setMinutes(minute: Number): void; + + /** + * Returns the minute of the given calendar field. + */ + getMinutes(): Number; + + /** + * set the second of the given calendar field. + */ + setSeconds(second: Number): void; + + /** + * Returns the second of the given calendar field. + */ + getSeconds(): Number; + + /** + * set the millisecond of the given calendar field. + */ + setMilliSeconds(second: Number): void; + + /** + * Returns the millisecond of the given calendar field. + */ + getMilliSeconds(): Number; + + /** + * Returns the week of year of the given calendar field. + */ + getWeekOfYear(): Number; + + /** + * Returns the week of month of the given calendar field. + */ + getWeekOfMonth(): Number; + + /** + * Returns the day of year of the given calendar field. + */ + getDayOfYear(): Number; + + /** + * Returns the day of week of the given calendar field. sunday is 0, monday is 1 + */ + getDayOfWeek(): Number; + + /** + * Returns the day of week in month of the given calendar field. + */ + getDayOfWeekInMonth(): Number; + + /** + * add the year of the given calendar field. + */ + addYear(amount: Number): void; + + /** + * add the month of the given calendar field. + */ + addMonth(amount: Number): void; + + /** + * add the day of month of the given calendar field. + */ + addDayOfMonth(amount: Number): void; + + /** + * add the hour of day of the given calendar field. + */ + addHourOfDay(amount: Number): void; + + /** + * add the minute of the given calendar field. + */ + addMinute(amount: Number): void; + + /** + * add the second of the given calendar field. + */ + addSecond(amount: Number): void; + + /** + * add the millisecond of the given calendar field. + */ + addMilliSecond(amount: Number): void; + + /** + * Returns the week number of year represented by this GregorianCalendar. + */ + getWeekYear(): Number; + + /** + * Sets this GregorianCalendar to the date given by the date specifiers - weekYear, weekOfYear, and dayOfWeek. + * weekOfYear follows the WEEK_OF_YEAR numbering. + * The dayOfWeek value must be one of the DAY_OF_WEEK values: SUNDAY to SATURDAY. + * weekYear: the week year + * weekOfYear: the week number based on weekYear + * dayOfWeek: the day of week value + */ + setWeekDate(weekYear: Number, weekOfYear: Number, dayOfWeek: Number): void; + + /** + * Returns the number of weeks in the week year + */ + getWeeksInWeekYear(): Number; + + /** + * Returns a clone of current instance + */ + clone(): GregorianCalendar; + + equals(other: GregorianCalendar): boolean; + + /** + * compare this object and other by day. return -1 0 or 1 + */ + compareToDay(other: GregorianCalendar): Number; + + /** + * clear all field of current instance + */ + clear(): void; + } + + export = GregorianCalendar; +} + +declare module 'gregorian-calendar-format' { + + import GregorianCalendar = require('gregorian-calendar'); + + enum DateTimeStyle { + /** + * full style + */ + FULL = 0, + /** + * long style + */ + LONG, + /** + * medium style + */ + MEDIUM, + /** + * short style + */ + SHORT, + } + + class DateTimeFormat { + + public Style: DateTimeStyle; + + /** + * @param pattern The format pattern string + * @param locale The local of to output (defaults to require('gregorian-calendar/lib/locale/en_US'), + * may also be one of: + * require('gregorian-calendar/lib/locale/zh_CN') + * require('gregorian-calendar/lib/locale/ru_RU') + */ + constructor(pattern: string, locale?: Object); + + /** + * format an instance of GregorianCalendar according to pattern + */ + format(calendar: GregorianCalendar): String; + + /** + * parse a dateString to an instance of GregorianCalendar according to pattern, it's better to specify calendarLocale, such as + * `df.parse('2013-11-12', {locale: require('gregorian-calendar/lib/locale/zh_CN'}));` + */ + parse(dateString: String, {locale: Object}): GregorianCalendar; + + /** + * get a predefine GregorianCalendarFormat instance + */ + getDateTimeInstance(dateStyle: DateTimeStyle, timeStyle: DateTimeStyle, locale?: Object): DateTimeFormat; + } + + export = DateTimeFormat; +} + From b99577c66564b69f9ba44758e19eb4e603b264c4 Mon Sep 17 00:00:00 2001 From: Oscar Lorentzon Date: Mon, 27 Jun 2016 22:27:41 +0200 Subject: [PATCH 04/20] Correct param and return types for ShapeUtils triangulation methods. --- threejs/three.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index c7a36b3234..389d247e53 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -5725,8 +5725,8 @@ declare namespace THREE { export namespace ShapeUtils { export function area(contour: number[]): number; - export function triangulate(contour: number[], indices: boolean): number[]; - export function triangulateShape(contour: number[], holes: any[]): number[]; + export function triangulate(contour: Vector2[], indices: boolean): Vector2[][] | number[][]; + export function triangulateShape(contour: Vector2[], holes: Vector2[][]): Vector2[][]; export function isClockWise(pts: number[]): boolean; export function b2(t: number, p0: number, p1: number, p2: number): number; export function b3(t: number, p0: number, p1: number, p2: number, p3: number): number; From eb821bbef5de5b1b50593412afdab382bea7c7ca Mon Sep 17 00:00:00 2001 From: Ching Yaw Hao Date: Tue, 28 Jun 2016 12:04:37 +0800 Subject: [PATCH 05/20] Added updateTextFields() to materialize css --- materialize-css/materialize-css.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/materialize-css/materialize-css.d.ts b/materialize-css/materialize-css.d.ts index 3459772c5f..34f32bb8e0 100644 --- a/materialize-css/materialize-css.d.ts +++ b/materialize-css/materialize-css.d.ts @@ -89,7 +89,7 @@ declare namespace Materialize { * Default: 400 */ height?: number; - +https://github.com/chingyawhao/DefinitelyTyped.git /** * Set the duration of the transition animation in ms. * Default: 500 @@ -319,6 +319,11 @@ declare namespace Materialize { * @name selector the selector for the image to fade in */ fadeInImage(selector:string): void; + + /** + * Update all text field to reinitialize all the Materialize labels on the page if dynamically adding inputs + */ + updateTextFields(): void; } } From 9f1ac3ded926339e3e49074b159888c7c09a272f Mon Sep 17 00:00:00 2001 From: Ching Yaw Hao Date: Tue, 28 Jun 2016 12:09:06 +0800 Subject: [PATCH 06/20] Delete accidentally copied text --- materialize-css/materialize-css.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/materialize-css/materialize-css.d.ts b/materialize-css/materialize-css.d.ts index 34f32bb8e0..b5b0f2c913 100644 --- a/materialize-css/materialize-css.d.ts +++ b/materialize-css/materialize-css.d.ts @@ -89,7 +89,7 @@ declare namespace Materialize { * Default: 400 */ height?: number; -https://github.com/chingyawhao/DefinitelyTyped.git + /** * Set the duration of the transition animation in ms. * Default: 500 From 94d01eab1634a62e4b3a6536d1ecc276352dd9dd Mon Sep 17 00:00:00 2001 From: Ching Yaw Hao Date: Tue, 28 Jun 2016 12:13:03 +0800 Subject: [PATCH 07/20] Added a line of test --- materialize-css/materialize-css-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/materialize-css/materialize-css-tests.ts b/materialize-css/materialize-css-tests.ts index a17e9128ae..9c9027a972 100644 --- a/materialize-css/materialize-css-tests.ts +++ b/materialize-css/materialize-css-tests.ts @@ -238,3 +238,5 @@ var tabsHtml = '
' + // Transitions Materialize.showStaggeredList('#staggered-test'); + +Materialize.updateTextFields(); \ No newline at end of file From 64295137243573d3f7b9a0dffa7390d0b8c241ba Mon Sep 17 00:00:00 2001 From: James McCallum Date: Sun, 27 Dec 2015 15:23:05 -0800 Subject: [PATCH 08/20] Updated extent - added [Date, Date] return type The interfaces for extent don't seem to cover the common date extent scenario - I can see there's one covering generics with a generic argument accessor but it's return type is still limited to 'primitive' (toString()-able) or the original object type 'U' - not a date typed property of U. In any case the standard x.domain(d3.extent(data, d=> d.date)) where data is an array of objects currently gives type errors in typescript - maybe this fix is a very specific case and there's a better generic way to approach, but I can see there are already dedicated overloads for [number, number] and [string, string] --- d3/d3.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index b35d898522..3f07ff6129 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1078,6 +1078,11 @@ declare namespace d3 { * Return the min and max simultaneously. */ export function extent(array: T[], accessor: (datum: T, index: number) => string): [string, string]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: T[], accessor: (datum: T, index: number) => Date): [Date, Date]; /** * Return the min and max simultaneously. From 626e4aa1e48091285b6c9bdf2c893599e43f5b4b Mon Sep 17 00:00:00 2001 From: Leon Radley Date: Wed, 22 Jun 2016 07:19:22 +0200 Subject: [PATCH 09/20] d3 extent should take array T, not array U --- d3/d3.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 3f07ff6129..1da10a78ab 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1087,7 +1087,7 @@ declare namespace d3 { /** * Return the min and max simultaneously. */ - export function extent(array: U[], accessor: (datum: T, index: number) => U): [U | Primitive, U | Primitive]; + export function extent(array: T[], accessor: (datum: T, index: number) => U): [U | Primitive, U | Primitive]; /** * Compute the sum of an array of numbers. From 6f066b8a210f2ac4a241af3e7b4bd7f41b25e734 Mon Sep 17 00:00:00 2001 From: Niels Boogaard Date: Tue, 28 Jun 2016 09:25:51 +0200 Subject: [PATCH 10/20] Added definition files for PDFObject --- pdfobject/pdfobject-tests.ts | 25 +++++++++++++++++++++++++ pdfobject/pdfobject.d.ts | 16 ++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 pdfobject/pdfobject-tests.ts create mode 100644 pdfobject/pdfobject.d.ts diff --git a/pdfobject/pdfobject-tests.ts b/pdfobject/pdfobject-tests.ts new file mode 100644 index 0000000000..1413a38e1b --- /dev/null +++ b/pdfobject/pdfobject-tests.ts @@ -0,0 +1,25 @@ +/// + +import PDFObject = require("pdfobject"); + +function test_embedding_with_url_only() { + var el:HTMLElement = PDFObject.embed("url"); +} + +function test_embedding_with_url_and_target() { + var el:HTMLElement = PDFObject.embed("url", ".css-selector"); +} + +function test_embedding_with_all_parameters() { + var el:HTMLElement = PDFObject.embed("url", ".css-selector", { + "height": "200px" + }); +} + +function test_pdf_object_version() { + var version:string = PDFObject.pdfobjectversion; +} + +function test_supports_pdfs() { + var supportsPDFs:boolean = PDFObject.supportsPDFs; +} diff --git a/pdfobject/pdfobject.d.ts b/pdfobject/pdfobject.d.ts new file mode 100644 index 0000000000..444bedc654 --- /dev/null +++ b/pdfobject/pdfobject.d.ts @@ -0,0 +1,16 @@ +// Type definitions for PDFObject v2.0.201604172 +// Project: https://github.com/pipwerks/PDFObject +// Definitions by: Niels Boogaard +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "pdfobject" { + interface PDFObject { + embed(url:string, target?:any, options?:any): HTMLElement; + pdfobjectversion: string; + supportsPDFs: boolean; + } + + var pdfObject: PDFObject; + export = pdfObject; + +} From a194f261c5151f3dd75d1ce7934e20f16a0f8101 Mon Sep 17 00:00:00 2001 From: Niels Boogaard Date: Tue, 28 Jun 2016 09:30:33 +0200 Subject: [PATCH 11/20] Made import ES6 compatible --- pdfobject/pdfobject-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pdfobject/pdfobject-tests.ts b/pdfobject/pdfobject-tests.ts index 1413a38e1b..db82802c52 100644 --- a/pdfobject/pdfobject-tests.ts +++ b/pdfobject/pdfobject-tests.ts @@ -1,6 +1,6 @@ /// -import PDFObject = require("pdfobject"); +import * as PDFObject from "pdfobject"; function test_embedding_with_url_only() { var el:HTMLElement = PDFObject.embed("url"); From 3bbe35a4cfdf09bd2a87ed660bf918131679da19 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Tue, 28 Jun 2016 18:28:02 +0900 Subject: [PATCH 12/20] feat: update `request-promise` type definition to v3 (#9855) --- request-promise/request-promise-tests.ts | 58 +++++++++++---- request-promise/request-promise.d.ts | 95 ++++++++++++++++++------ 2 files changed, 118 insertions(+), 35 deletions(-) diff --git a/request-promise/request-promise-tests.ts b/request-promise/request-promise-tests.ts index 8c7840ad41..28596f18d4 100644 --- a/request-promise/request-promise-tests.ts +++ b/request-promise/request-promise-tests.ts @@ -1,13 +1,13 @@ /// import rp = require('request-promise'); -import nodeRequest = require('request'); +import errors = require('request-promise/errors'); rp('http://www.google.com') .then(console.dir) .catch(console.error); -var options: nodeRequest.Options = { +var options: rp.Options = { uri : 'http://posttestserver.com/post.php', method : 'POST', json: true, @@ -18,7 +18,39 @@ rp(options) .then(console.dir) .catch(console.error); -// --> Displays length of response from server after post +rp('http://google.com').finally(() => {}); + +// This works: +rp('http://google.com').then(console.dir); +rp('http://google.com').catch(console.error); +rp('http://google.com').then(console.dir, console.error); + +// This works as well since additional methods are only used AFTER the FIRST call in the chain: +rp('http://google.com').then(console.dir).spread(console.dir); +rp('http://google.com').catch(console.error).error(console.error); + +// Use .promise() in these cases: +rp('http://google.com').promise().bind(this).then(console.dir); + +rp({ uri: 'http://google.com', resolveWithFullResponse: true }).then((response) => {}); +rp({ uri: 'http://google.com', simple: false }).catch((reason) => {}); + +rp({ + uri: 'http://google.com', + transform: (body: any, response: http.IncomingMessage, resolveWithFullResponse: boolean): any => { + throw new Error('Transform failed!'); + } +}).catch(errors.StatusCodeError, (reason: errors.StatusCodeError) => { + // The server responded with a status codes other than 2xx. + // Check reason.statusCode +}).catch(errors.RequestError, (reason: errors.RequestError) => { + // The request failed due to technical reasons. + // reason.cause is the Error object Request would pass into a callback. +}).catch(errors.TransformError, (reason: errors.TransformError) => { + console.log(reason.cause.message); // => Transform failed! + // reason.response is the original response for which the transform operation failed +}); + //Defaults tests (() => { @@ -46,7 +78,7 @@ rp(options) console.log("DELETE succeeded with status %d", response.statusCode); }) .catch(console.error); - + //The following examples from https://github.com/request/request import fs = require('fs'); import http = require('http'); @@ -71,14 +103,14 @@ request console.log(response.headers['content-type']); // 'image/png' }) .pipe(request.put('http://mysite.com/img.png')); - + request .get('http://mysite.com/doodle.png') .on('error', function(err: any) { console.log(err); }) .pipe(fs.createWriteStream('doodle.png')); - + http.createServer(function (req, resp) { if (req.url === '/doodle.png') { if (req.method === 'PUT') { @@ -98,7 +130,7 @@ http.createServer(function (req, resp) { }); var resp: http.ServerResponse; -var req: nodeRequest.Request; +var req: rp.RequestPromise; req.pipe(request('http://mysite.com/doodle.png')).pipe(resp); var r = request; @@ -192,7 +224,7 @@ request({ } console.log('Upload successful! Server responded with:', body); }); - + request.get('http://some.server.com/').auth('username', 'password', false); // or request.get('http://some.server.com/', { @@ -282,8 +314,8 @@ request.post({url:url, oauth:oauth}, function (e, r, body) { , token_secret: perm_data.oauth_token_secret }; var url = 'https://api.twitter.com/1.1/users/show.json'; - var query = { - screen_name: perm_data.screen_name, + var query = { + screen_name: perm_data.screen_name, user_id: perm_data.user_id }; request.get({url:url, oauth:oauth, qs:query, json:true}, function (e, r, user) { @@ -370,7 +402,7 @@ request({ } } }); - + //requests using baseRequest() will set the 'x-token' header var baseRequest = request.defaults({ headers: {'x-token': 'my-token'} @@ -420,7 +452,7 @@ var rand = Math.floor(Math.random()*100000000).toString(); } } ); - + request( { method: 'GET' , uri: 'http://www.google.com' @@ -442,7 +474,7 @@ request( console.log('received ' + data.length + ' bytes of compressed data') }) }); - + var requestWithJar = request.defaults({jar: true}) requestWithJar('http://www.google.com', function () { requestWithJar('http://images.google.com'); diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index 7c96689f56..a9d6cae855 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -1,33 +1,84 @@ -// Type definitions for request-promise v0.4.2 -// Project: https://www.npmjs.com/package/request-promise -// Definitions by: Christopher Glantschnig , Joe Skeen +// Type definitions for request-promise v3.0.0 +// Project: https://github.com/request/request-promise +// Definitions by: Christopher Glantschnig , Joe Skeen , Aya Morisawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Change [0]: 2015/08/20 - Aya Morisawa - /// /// declare module 'request-promise' { import request = require('request'); import http = require('http'); - - interface RequestPromise extends request.Request { - then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; - then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; - catch(onrejected?: (reason: any) => any | PromiseLike): Promise; - catch(onrejected?: (reason: any) => void): Promise; - finally(handler: () => PromiseLike): Promise; - finally(handler: () => TResult): Promise; - promise(): Promise; + import errors = require('request-promise/errors'); + + namespace requestPromise { + interface RequestPromise extends request.Request { + then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + catch(onrejected?: (reason: any) => any | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; + catch(type: errors.RequestErrorConstructor, onrejected?: (reason: errors.RequestError) => void): Promise; + catch(type: errors.StatusCodeErrorConstructor, onrejected?: (reason: errors.StatusCodeError) => void): Promise; + catch(type: errors.TransformErrorConstructor, onrejected?: (reason: errors.TransformError) => void): Promise; + finally(handler: () => PromiseLike): Promise; + finally(handler: () => TResult): Promise; + promise(): Promise; + } + + interface RequestPromiseOptions extends request.CoreOptions { + simple?: boolean; + transform?: (body: any, response: http.IncomingMessage, resolveWithFullResponse?: boolean) => any; + resolveWithFullResponse?: boolean; + } + + export type OptionsWithUri = request.UriOptions & RequestPromiseOptions; + export type OptionsWithUrl = request.UrlOptions & RequestPromiseOptions; + export type Options = OptionsWithUri | OptionsWithUrl; } - - interface RequestPromiseOptions extends request.CoreOptions { - simple?: boolean; - transform?: (body: any, response: http.IncomingMessage) => any; - resolveWithFullResponse?: boolean; - } - - var requestPromise: request.RequestAPI; + + var requestPromise: request.RequestAPI; export = requestPromise; } +declare module 'request-promise/errors' { + import rp = require('request-promise'); + import http = require('http'); + + export interface RequestError extends Error { + cause: any; + error: any; + options: rp.Options; + response: http.IncomingMessage; + } + export interface RequestErrorConstructor { + new (cause: any, options: rp.Options, response: http.IncomingMessage): RequestError; + (cause: any, options: rp.Options, response: http.IncomingMessage): RequestError; + prototype: RequestError; + } + export const RequestError: RequestErrorConstructor; + + export interface StatusCodeError extends Error { + statusCode: number; + error: any; + options: rp.Options; + response: http.IncomingMessage; + } + export interface StatusCodeErrorConstructor extends Error { + new (statusCode: number, body: any, options: rp.Options, response: http.IncomingMessage): StatusCodeError; + (statusCode: number, body: any, options: rp.Options, response: http.IncomingMessage): StatusCodeError; + prototype: StatusCodeError; + } + export const StatusCodeError: StatusCodeErrorConstructor; + + export interface TransformError extends Error { + cause: any; + error: any; + options: rp.Options; + response: http.IncomingMessage; + } + export interface TransformErrorConstructor extends Error { + new (cause: any, options: rp.Options, response: http.IncomingMessage): TransformError; + (cause: any, options: rp.Options, response: http.IncomingMessage): TransformError; + prototype: TransformError; + } + export const TransformError: TransformErrorConstructor; +} From f54ef56c167e9fd99a6acc2a8c6c01a4d91860a9 Mon Sep 17 00:00:00 2001 From: Roman Reshetnikov Date: Tue, 28 Jun 2016 13:40:27 +0300 Subject: [PATCH 13/20] fix-readme --- devexpress-web/README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/devexpress-web/README.md b/devexpress-web/README.md index 4f1fa6c590..341304e192 100644 --- a/devexpress-web/README.md +++ b/devexpress-web/README.md @@ -1,7 +1,15 @@ -# DevExpress ASP.NET/MVC TypeScript definitions # +DevExpress ASP.NET/MVC TypeScript definitions +============================================= -You can use these TypeScript definitions for your web projects, which contain DevExpress ASP.NET or MVC controls. For this, simply add at the top of your code. -  -The API enclosed into the DevExpress ASP.NET/MVC TypeScript definition file fully corresponds to the API described in the DevExpress ASP.NET/MVC Documentation: [Reference](https://documentation.devexpress.com/#AspNet/DevExpressWebScripts). -  -If you have any issues while using the DevExpress ASP.NET/MVC TypeScript definitions, please refer to our [Support Center](https://www.devexpress.com/Support/Center/Question/List/1). \ No newline at end of file +You can use these TypeScript definitions for your web projects, which contain +DevExpress ASP.NET or MVC controls. For this, simply add at the top of your +code ``. + +The API enclosed into the DevExpress ASP.NET/MVC TypeScript definition file +fully corresponds to the API described in the DevExpress ASP.NET/MVC +Documentation: +[Reference](https://documentation.devexpress.com/#AspNet/DevExpressWebScripts). + +If you have any issues while using the DevExpress ASP.NET/MVC TypeScript +definitions, please refer to our [Support +Center](https://www.devexpress.com/Support/Center/Question/List/1). From c4d63af4ec126eaa52d191b4914c65250a027a50 Mon Sep 17 00:00:00 2001 From: Thomas-P Date: Tue, 28 Jun 2016 13:42:30 +0200 Subject: [PATCH 14/20] Fixing return values for Observable functions All Observable functions return an Observable instead of T. So I fixed this in the rx-lite.d.ts --- rx/rx-lite-tests.ts | 33 +++++++++++++++++++++++++++++++++ rx/rx-lite.d.ts | 12 ++++++------ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/rx/rx-lite-tests.ts b/rx/rx-lite-tests.ts index 9949fa2ea8..a6adbdc289 100644 --- a/rx/rx-lite-tests.ts +++ b/rx/rx-lite-tests.ts @@ -9,5 +9,38 @@ function test_scan() { const source2: Rx.Observable = Rx.Observable.range(1, 3) .scan((acc, x, i, source) => acc + x, '...'); + + /* concatAll Example */ + var source = Rx.Observable.range(0, 3) + .map(function (x) { return Rx.Observable.range(x, 3); }) + .concatAll(); + + var subscription = source.subscribe( + function (x) { + console.log('Next: %s', x); + }, + function (err) { + console.log('Error: %s', err); + }, + function () { + console.log('Completed'); + }); + + /* mergeAll example */ + var source = Rx.Observable.range(0, 3) + .map(function (x) { return Rx.Observable.range(x, 3); }) + .mergeAll(); + + var subscription = source.subscribe( + function (x) { + console.log('Next: %s', x); + }, + function (err) { + console.log('Error: %s', err); + }, + function () { + console.log('Completed'); + }); + } diff --git a/rx/rx-lite.d.ts b/rx/rx-lite.d.ts index aa8137f7b7..f159979204 100644 --- a/rx/rx-lite.d.ts +++ b/rx/rx-lite.d.ts @@ -245,8 +245,8 @@ declare namespace Rx { withLatestFrom(souces: (Observable|IPromise)[], resultSelector: (firstValue: T, ...otherValues: TOther[]) => TResult): Observable; concat(...sources: (Observable|IPromise)[]): Observable; concat(sources: (Observable|IPromise)[]): Observable; - concatAll(): T; - concatObservable(): T; // alias for concatAll + concatAll(): Observable; + concatObservable(): Observable; // alias for concatAll concatMap(selector: (value: T, index: number) => Observable, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; // alias for selectConcat concatMap(selector: (value: T, index: number) => IPromise, resultSelector: (value1: T, value2: T2, index: number) => R): Observable; // alias for selectConcat concatMap(selector: (value: T, index: number) => Observable): Observable; // alias for selectConcat @@ -257,12 +257,12 @@ declare namespace Rx { merge(maxConcurrent: number): T; merge(other: Observable): Observable; merge(other: IPromise): Observable; - mergeAll(): T; - mergeObservable(): T; // alias for mergeAll + mergeAll(): Observable; + mergeObservable(): Observable; // alias for mergeAll skipUntil(other: Observable): Observable; skipUntil(other: IPromise): Observable; - switch(): T; - switchLatest(): T; // alias for switch + switch(): Observable; + switchLatest(): Observable; // alias for switch takeUntil(other: Observable): Observable; takeUntil(other: IPromise): Observable; zip(second: Observable|IPromise): Observable<[T, T2]>; From d8624312bec253b79552377fa968a3cca454e530 Mon Sep 17 00:00:00 2001 From: Casper Skydt Date: Tue, 28 Jun 2016 18:12:51 +0200 Subject: [PATCH 15/20] Added callback type for sts.assumerole --- aws-sdk/aws-sdk.d.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/aws-sdk/aws-sdk.d.ts b/aws-sdk/aws-sdk.d.ts index 5946d25982..94e13c93d2 100644 --- a/aws-sdk/aws-sdk.d.ts +++ b/aws-sdk/aws-sdk.d.ts @@ -164,7 +164,7 @@ declare module "aws-sdk" { /** * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) that you can use to access AWS resources that you might not normally have access to. */ - assumeRole(params: sts.AssumeRoleParams, callback: (err: any, data: any) => void): void; + assumeRole(params: sts.AssumeRoleParams, callback: (err: any, data: sts.AssumeRoleCallbackData) => void): void; /** * Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response. @@ -1408,6 +1408,24 @@ declare module "aws-sdk" { TokenCode?: string; } + export interface AssumeRoleCallbackData{ + Credentials: TemporaryCredentials; + AssumedRoleUser: AssumedRoleUser; + PackedPolicySize: number; + } + + export interface TemporaryCredentials{ + AccessKeyId: string; + SecretAccessKey: string; + SessionToken: string; + Expiration: Date; + } + + export interface AssumedRoleUser{ + AssumedRoleId: string; + Arn: string; + } + export interface AssumeRoleWithSAMLParams { PrincipalArn: string; RoleArn: string; From 490fa83686bd6b8fec78db45a67fee911519bdc9 Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Wed, 18 May 2016 10:00:21 -0700 Subject: [PATCH 16/20] react-select: exporting `ReactSelectProps` --- react-select/react-select.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index af8d082a1c..a6cb87a2b3 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -420,7 +420,8 @@ declare module "react-select-props" { interface Option extends ReactSelect.Option {} interface MenuRendererProps extends ReactSelect.MenuRendererProps {} - - export { MenuRendererProps, Option }; + interface ReactSelectProps extends ReactSelect.ReactSelectProps {} + + export { MenuRendererProps, ReactSelectProps, Option }; } From 5c8b96468667ad55424079bd8368ccedfa9cdf7b Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Wed, 18 May 2016 10:05:27 -0700 Subject: [PATCH 17/20] react-select: exporting `ReactAsyncSelectProps` --- react-select/react-select.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index a6cb87a2b3..f0609641ec 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -421,7 +421,8 @@ declare module "react-select-props" { interface Option extends ReactSelect.Option {} interface MenuRendererProps extends ReactSelect.MenuRendererProps {} interface ReactSelectProps extends ReactSelect.ReactSelectProps {} + interface ReactAsyncSelectProps extends ReactSelect.ReactAsyncSelectProps {} - export { MenuRendererProps, ReactSelectProps, Option }; + export { MenuRendererProps, ReactSelectProps, ReactAsyncSelectProps, Option }; } From 1defb4cf40a3438bf1667433c4ed43bf5f4f099f Mon Sep 17 00:00:00 2001 From: Charles Arnold Date: Tue, 28 Jun 2016 09:35:31 -0700 Subject: [PATCH 18/20] react-select: fix issue with props `ref` not set to correct type, and update tests to test additional React.Props types --- react-select/react-select-tests.tsx | 120 ++++++++++++++-------------- react-select/react-select.d.ts | 24 +++--- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index 7817fe905d..acd84badba 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; -import { Option, MenuRendererProps } from "react-select-props"; +import { Option, ReactSelectProps, ReactAsyncSelectProps, MenuRendererProps } from "react-select-props"; import Select = require("react-select"); const CustomOption = React.createClass({ @@ -78,42 +78,43 @@ class SelectTest extends React.Component, {}> { const onClose = () => { return; }; const optionRenderer = (option: Option) => {option.label} + const selectProps: ReactSelectProps = { + name: "test-select", + className: "test-select", + key: "1", + options: options, + optionRenderer: optionRenderer, + allowCreate: true, + autofocus: true, + autosize: true, + clearable: true, + escapeClearsValue: true, + ignoreAccents: true, + joinValues: false, + matchPos: "any", + matchProp: "any", + menuContainerStyle: {}, + menuRenderer: renderMenu, + menuStyle: {}, + multi: true, + onMenuScrollToBottom: () => {}, + onValueClick: onChange, + onOpen: onOpen, + onClose: onClose, + openAfterFocus: false, + optionComponent: CustomOption, + required: false, + resetValue: "resetValue", + scrollMenuIntoView: false, + valueKey: "github", + labelKey: "name", + onChange: onChange, + value: options, + valueComponent: CustomValue, + }; + return
-
; } } @@ -128,29 +129,32 @@ class SelectAsyncTest extends React.Component, {}> { }; const options: Option[] = [{ label: "Foo", value: "bar" }]; const onChange = (value: any) => console.log(value); + + const asyncSelectProps: ReactAsyncSelectProps = { + name: "test-select", + className: "test-select", + key: "1", + matchPos: "any", + matchProp: "any", + multi: true, + onValueClick: onChange, + valueKey: "github", + labelKey: "name", + onChange: onChange, + simpleValue: undefined, + value: options, + loadOptions: getOptions, + cache: {}, + ignoreAccents: false, + ignoreCase: true, + isLoading: false, + minimumInput: 5, + searchPromptText: "search...", + searchingText: "searching...", + }; + return
- +
; } diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index f0609641ec..628316dfa8 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -62,7 +62,7 @@ declare namespace ReactSelect { valueArray: Option[]; } - interface ReactSelectProps extends __React.Props { + interface ReactSelectProps extends __React.Props { /** * text to display when `allowCreate` is true. * @default 'Add "{label}"?' @@ -401,28 +401,24 @@ declare namespace ReactSelect { searchingText?: string; } - interface ReactSelect extends __React.ReactElement { } - interface ReactSelectAsyncClass extends __React.ComponentClass { + class ReactSelectAsyncClass extends __React.Component { } - const Async: ReactSelectAsyncClass; - interface ReactSelectClass extends __React.ComponentClass { - Async: ReactSelectAsyncClass; + class ReactSelectClass extends __React.Component { + static Async: ReactSelectAsyncClass; } } declare module "react-select" { - const RS: ReactSelect.ReactSelectClass; - export = RS; + export = ReactSelect.ReactSelectClass; } declare module "react-select-props" { - interface Option extends ReactSelect.Option {} - interface MenuRendererProps extends ReactSelect.MenuRendererProps {} - interface ReactSelectProps extends ReactSelect.ReactSelectProps {} - interface ReactAsyncSelectProps extends ReactSelect.ReactAsyncSelectProps {} - + import Option = ReactSelect.Option; + import MenuRendererProps = ReactSelect.MenuRendererProps; + import ReactSelectProps = ReactSelect.ReactSelectProps; + import ReactAsyncSelectProps = ReactSelect.ReactAsyncSelectProps; + export { MenuRendererProps, ReactSelectProps, ReactAsyncSelectProps, Option }; } - From 64e780546b9a6de3c9ca4594e73c8fde2bb8218d Mon Sep 17 00:00:00 2001 From: Dominic Alie Date: Tue, 28 Jun 2016 14:09:49 -0400 Subject: [PATCH 19/20] Add method overload to allow inline StickyState object --- ui-router-extras/ui-router-extras-tests.ts | 81 ++++++++++++++++++++++ ui-router-extras/ui-router-extras.d.ts | 4 ++ 2 files changed, 85 insertions(+) diff --git a/ui-router-extras/ui-router-extras-tests.ts b/ui-router-extras/ui-router-extras-tests.ts index 045a3049c7..b50f034de7 100644 --- a/ui-router-extras/ui-router-extras-tests.ts +++ b/ui-router-extras/ui-router-extras-tests.ts @@ -45,4 +45,85 @@ myApp.config(($stateProvider: angular.ui.IStateProvider, $stickyStateProvider: a $stickyStateProvider.enableDebug(true); $stateProvider.state(state); + + $stateProvider.state({ + name: 'test', + sticky: true, + dsr: { + default: 'substate', + params: ['param1', 'param2'], + fn: function ($dsr$) { + + return $dsr$.to; + } + }, + onInactivate: function ($state: angular.ui.IState) { + var iAmInjectedByInjector = $state; + }, + onReactivate: function ($state: angular.ui.IState) { + var iAmInjectedByInjector = $state; + }, + controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { + $previousState.memo('test-memo1'); + $previousState.memo('test-memo2', 'test-state-name2'); + $previousState.memo('test-memo3', 'test-state-name3', {}); + $previousState.forget('test-memo3'); + $previousState.go('test-memo2', { + location: true, + notify: true + }); + $previousState.get(); + $previousState.get('test-memo1'); + + $deepstateRedirect.reset('statename1', { + 'stateParam1': ['value1', 'value2'], + 'stateParam2': 'value' + }); + }, + views: { + //named views are mandatory + 'name1': {} + } + }); + + $stateProvider.state('name1', { + name: 'test', + sticky: true, + dsr: { + default: 'substate', + params: ['param1', 'param2'], + fn: function ($dsr$) { + + return $dsr$.to; + } + }, + onInactivate: function ($state: angular.ui.IState) { + var iAmInjectedByInjector = $state; + }, + onReactivate: function ($state: angular.ui.IState) { + var iAmInjectedByInjector = $state; + }, + controller: ($previousState: angular.ui.IPreviousStateService, $deepstateRedirect: angular.ui.IDeepStateRedirectService) => { + $previousState.memo('test-memo1'); + $previousState.memo('test-memo2', 'test-state-name2'); + $previousState.memo('test-memo3', 'test-state-name3', {}); + $previousState.forget('test-memo3'); + $previousState.go('test-memo2', { + location: true, + notify: true + }); + $previousState.get(); + $previousState.get('test-memo1'); + + $deepstateRedirect.reset('statename1', { + 'stateParam1': ['value1', 'value2'], + 'stateParam2': 'value' + }); + }, + views: { + //named views are mandatory + 'name1': {} + } + }); + }); diff --git a/ui-router-extras/ui-router-extras.d.ts b/ui-router-extras/ui-router-extras.d.ts index 0c4673e915..ecc8d7e6ba 100644 --- a/ui-router-extras/ui-router-extras.d.ts +++ b/ui-router-extras/ui-router-extras.d.ts @@ -148,4 +148,8 @@ declare namespace angular.ui { registerStickyState(state: IStickyState): void; } + interface IStateProvider extends angular.IServiceProvider { + state(config: IStickyState): IStateProvider; + state(name: string, config: IStickyState): IStateProvider; + } } From 43449c604f997d75e917769c662e3d3b3fb2c0ae Mon Sep 17 00:00:00 2001 From: Cao Jiannan Date: Wed, 29 Jun 2016 09:46:09 +0800 Subject: [PATCH 20/20] Mongoose - fix post callback (#9850) * fix post function * fix tests --- mongoose/mongoose-tests.ts | 2 +- mongoose/mongoose.d.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index cd5f53c4d9..2f6467437c 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -369,7 +369,7 @@ schema.path('name'); schema.path('name', Number); schema.pathType('name'); schema.plugin(function() {}); -schema.post('save', function(next: () => void, doc: IActor) {}); +schema.post('save', function(doc: IActor) {}); schema.pre('save', function(next: () => void) {}); schema.requiredPaths(); schema.static('findByName', function(name: string, callback: () => void) {}); diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index 6d74a0e4b1..7a4d33c522 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -276,8 +276,7 @@ declare module "mongoose" { pre(method: string, fn: HookSyncCallback, errorCb?: HookErrorCallback): Schema; pre(method: string, isAsync: boolean, fn: HookAsyncCallback, errorCb?: HookErrorCallback): Schema; - post(method: string, fn: HookSyncCallback, errorCb?: HookErrorCallback): Schema; - post(method: string, isAsync: boolean, fn: HookAsyncCallback, errorCb?: HookErrorCallback): Schema; + post(method: string, fn: (doc: Document, next?: HookNextFunction) => any ): Schema; requiredPaths(): string[]; set(key: string, value: any): void;