[jquery] Overriding the beforeSend function for AjaxSettings and UrlAjaxSettings to indicate a more appropriate settings parameter type

Fixed errors when running lint
This commit is contained in:
icnocop
2017-11-29 18:30:41 -08:00
parent c0258950ca
commit 1e7989f8ce
5 changed files with 28 additions and 8 deletions
+16
View File
@@ -5405,6 +5405,14 @@ declare namespace JQuery {
* A string containing the URL to which the request is sent.
*/
url?: string;
/**
* A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x,
* XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and
* settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend
* function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless
* of the type of request.
*/
beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettings<TContext>): false | void;
}
interface UrlAjaxSettings<TContext = any> extends Ajax.AjaxSettingsBase<TContext> {
@@ -5412,6 +5420,14 @@ declare namespace JQuery {
* A string containing the URL to which the request is sent.
*/
url: string;
/**
* A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x,
* XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and
* settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend
* function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless
* of the type of request.
*/
beforeSend?(this: TContext, jqXHR: jqXHR, settings: UrlAjaxSettings<TContext>): false | void;
}
namespace Ajax {
+2 -4
View File
@@ -1,5 +1,3 @@
// tslint:disable:interface-name
function JQueryStatic() {
function type_assertion() {
const $Canvas = $ as JQueryStatic<HTMLCanvasElement>;
@@ -6195,7 +6193,7 @@ function JQuery_AjaxSettings() {
this;
// $ExpectType jqXHR<any>
jqXHR;
// $ExpectType AjaxSettingsBase<any>
// $ExpectType AjaxSettings<any>
settings;
},
cache: false,
@@ -6305,7 +6303,7 @@ function JQuery_AjaxSettings() {
this;
// $ExpectType jqXHR<any>
jqXHR;
// $ExpectType AjaxSettingsBase<any>
// $ExpectType AjaxSettings<any>
settings;
return false;
-2
View File
@@ -1,5 +1,3 @@
/* tslint:disable:no-arg object-literal-shorthand one-variable-per-declaration only-arrow-functions prefer-const prefer-for-of triple-equals no-var */
function examples() {
function add_0() {
$('div').css('border', '2px solid red')
-2
View File
@@ -1,5 +1,3 @@
/* tslint:disable:object-literal-key-quotes object-literal-shorthand one-variable-per-declaration only-arrow-functions prefer-const prefer-for-of triple-equals no-var */
function longdesc() {
function add_0() {
$('p').add('div').addClass('widget');
+10
View File
@@ -5,7 +5,9 @@
"await-promise": false,
"ban-types": false,
"callable-types": false,
"interface-name": false,
"no-any-union": false,
"no-arg": false,
"no-boolean-literal-compare": false,
"no-declare-current-package": false,
"no-empty-interface": false,
@@ -14,12 +16,20 @@
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-var": false,
"no-var-keyword": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-for-of": false,
"prefer-switch": false,
"prefer-template": false,
"space-before-function-paren": false,
"space-within-parens": false,
"triple-equals": false,
"use-default-type-parameter": false
}
}