[jquery] Add includeMargin parameter to .outerHeight() and .outerWidth() setters. (#29756)

* [jquery] Add `includeMargin` parameter to `.outerHeight()` and `.outerWidth()` setters.

See 354f6036f2/test/unit/dimensions.js (L477-L484).

* [jquery-awesome-cursor] Add missing `dom` lib target.

* [jquery-toast-plugin] Add missing `dom` lib target.

* [jquery.growl] Add missing `dom` lib target.

* [materialize-css] Disable `unified-signatures` rule for plugin overloads.

These overloads follow the jQuery plugin pattern and are effectively separate methods.

* [ng-cordova] Update promise types to be compatible with changes from `ng.IPromise`.

Ref: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/23115

* [ng-tags-input] Add missing `dom` lib target.

* [p-loading] Add missing `dom` lib target.

* [summernote] Add missing `dom` lib target.

* [swig-email-templates] Add missing `dom` lib target.

* [materialize-css] Unify signatures according to feedback.

See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29756#pullrequestreview-165249412.
This commit is contained in:
Leonard Thieu 2018-10-16 13:15:06 -04:00 committed by Sheetal Nandi
parent 67d82a3999
commit c3cbb348e2
15 changed files with 61 additions and 20 deletions

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@ -21610,7 +21610,8 @@ $( "div" ).one( "click", function() {
</html>
```
*/
outerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this;
outerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number),
includeMargin?: boolean): this;
/**
* Get the current computed outer height (including padding, border, and optionally margin) for the
* first element in the set of matched elements.
@ -21703,7 +21704,8 @@ $( "div" ).one( "click", function() {
</html>
```
*/
outerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this;
outerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number),
includeMargin?: boolean): this;
/**
* Get the current computed outer width (including padding, border, and optionally margin) for the
* first element in the set of matched elements.

View File

@ -2616,12 +2616,27 @@ function JQuery() {
}
function outerHeight() {
// $ExpectType JQuery<HTMLElement>
$('p').outerHeight({} as string | number, true);
// $ExpectType JQuery<HTMLElement>
$('p').outerHeight('200px');
// $ExpectType JQuery<HTMLElement>
$('p').outerHeight(400);
// $ExpectType JQuery<HTMLElement>
$('p').outerHeight(function(index, height) {
// $ExpectType HTMLElement
this;
// $ExpectType number
index;
// $ExpectType number
height;
return '200px';
}, false);
// $ExpectType JQuery<HTMLElement>
$('p').outerHeight(function(index, height) {
// $ExpectType HTMLElement
@ -2724,12 +2739,27 @@ function JQuery() {
}
function outerWidth() {
// $ExpectType JQuery<HTMLElement>
$('p').outerWidth({} as string | number, true);
// $ExpectType JQuery<HTMLElement>
$('p').outerWidth('200px');
// $ExpectType JQuery<HTMLElement>
$('p').outerWidth(400);
// $ExpectType JQuery<HTMLElement>
$('p').outerWidth(function(index, width) {
// $ExpectType HTMLElement
this;
// $ExpectType number
index;
// $ExpectType number
width;
return '200px';
}, false);
// $ExpectType JQuery<HTMLElement>
$('p').outerWidth(function(index, width) {
// $ExpectType HTMLElement

View File

@ -110,8 +110,6 @@ declare namespace M {
interface JQuery {
carousel(method: keyof Pick<M.Carousel, "destroy">): JQuery;
carousel(method: keyof Pick<M.Carousel, "next">, n?: number): JQuery;
carousel(method: keyof Pick<M.Carousel, "prev">, n?: number): JQuery;
carousel(method: keyof Pick<M.Carousel, "set">, n?: number): JQuery;
carousel(method: keyof Pick<M.Carousel, "next"> | keyof Pick<M.Carousel, "prev"> | keyof Pick<M.Carousel, "set">, n?: number): JQuery;
carousel(options?: Partial<M.CarouselOptions>): JQuery;
}

View File

@ -20,6 +20,5 @@ declare namespace M {
}
interface JQuery {
characterCounter(method: keyof Pick<M.CharacterCounter, "destroy">): JQuery;
characterCounter(): JQuery;
characterCounter(method?: keyof Pick<M.CharacterCounter, "destroy">): JQuery;
}

View File

@ -77,7 +77,6 @@ declare namespace M {
interface JQuery {
collapsible(method: keyof Pick<M.Collapsible, "destroy">): JQuery;
collapsible(method: keyof Pick<M.Collapsible, "open">, n: number): JQuery;
collapsible(method: keyof Pick<M.Collapsible, "close">, n: number): JQuery;
collapsible(method: keyof Pick<M.Collapsible, "open"> | keyof Pick<M.Collapsible, "close">, n: number): JQuery;
collapsible(options?: Partial<M.CollapsibleOptions>): JQuery;
}

View File

@ -20,6 +20,5 @@ declare namespace M {
}
interface JQuery {
range(): JQuery;
range(method: keyof Pick<M.Range, "destroy">): JQuery;
range(method?: keyof Pick<M.Range, "destroy">): JQuery;
}

View File

@ -36,7 +36,10 @@ declare namespace ngCordova {
}
export interface IFilePromise<T> extends ng.IPromise<T> {
then<TResult>(successCallback: (promiseValue: T) => ng.IPromise<TResult> | TResult, errorCallback?: (error: IFileError) => ng.IPromise<TResult> | TResult): ng.IPromise<TResult>;
then<TResult = T, TResult2 = never>(
successCallback: (promiseValue: T) => ng.IPromise<TResult> | TResult,
errorCallback?: (error: IFileError) => ng.IPromise<TResult2> | TResult2
): ng.IPromise<TResult | TResult2>;
catch<TResult>(onRejected: (error: IFileError) => ng.IPromise<TResult> | TResult): ng.IPromise<TResult>;
}

View File

@ -14,7 +14,11 @@ declare namespace ngCordova {
}
export interface IFileTransferPromise<T> extends ng.IPromise<T> {
then<TResult>(successCallback: (promiseValue: T) => ng.IPromise<TResult> | TResult, errorCallback?: (error: FileTransferError) => ng.IPromise<TResult> | TResult, notifyCallback?: (state: any) => any): ng.IPromise<TResult>;
then<TResult = T, TResult2 = never>(
successCallback: (promiseValue: T) => ng.IPromise<TResult> | TResult,
errorCallback?: (error: FileTransferError) => ng.IPromise<TResult2> | TResult2,
notifyCallback?: (state: any) => any
): ng.IPromise<TResult | TResult2>;
catch<TResult>(onRejected: (error: FileTransferError) => ng.IPromise<TResult> | TResult): ng.IPromise<TResult>;
}

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,

View File

@ -2,7 +2,8 @@
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,