function JQueryStatic() { function type_annotation() { const jq: JQueryStatic = $; } function ajaxSettings() { // $ExpectType AjaxSettings $.ajaxSettings; } function Animation() { // $ExpectType AnimationStatic $.Animation; } function Callbacks() { // $ExpectType CallbacksStatic $.Callbacks; } function cssHooks() { // $ExpectType CSSHooks $.cssHooks; } function cssNumber() { // $ExpectType PlainObject $.cssNumber; } function Deferred() { // $ExpectType DeferredStatic $.Deferred; } function easing() { // $ExpectType Easings $.easing; } function Event() { // $ExpectType EventStatic $.Event; } function event() { // $ExpectType EventExtensions $.event; } function expr() { // $ExpectType Selectors $.expr; } function fn() { // $ExpectType JQuery $.fn; } function fx() { // $ExpectType Effects $.fx; } function ready() { // $ExpectType Thenable $.ready; } function support() { // $ExpectType PlainObject $.support; } function timers() { // $ExpectType TickFunction[] $.timers; } function Tween() { // $ExpectType TweenStatic $.Tween; } function valHooks() { // $ExpectType ValHooks $.valHooks; } function call_signature() { // $ExpectType JQuery $('

', new Document()); // $ExpectType JQuery $('

', { class: 'my-div', on: { touchstart() { // Do something } } }); // $ExpectType JQuery $('

'); // $ExpectType JQuery $('span', new HTMLElement()); // $ExpectType JQuery $('span', new Document()); // $ExpectType JQuery $('span', $('p')); // $ExpectType JQuery $('span'); // $ExpectType JQuery $('.mysvgline'); // $ExpectType JQuery $(new HTMLParagraphElement()); // $ExpectType JQuery $([new HTMLParagraphElement()]); // $ExpectType JQuery<{ foo: string; hello: string; }> $({ foo: 'bar', hello: 'world' }); // $ExpectType JQuery $($(document.createElementNS("http://www.w3.org/2000/svg", "svg"))); // $ExpectType JQuery $(function($) { // $ExpectType Document this; // $ExpectType JQueryStatic $; }); // $ExpectType JQuery $(function($) { // $ExpectType Document this; // $ExpectType JQueryStatic $; }); // $ExpectType JQuery $(); // $ExpectType JQuery $(); // $ExpectType JQuery $(new HTMLSelectElement()); // $ExpectType JQuery $([new HTMLSelectElement()]); // $ExpectType JQuery $(document.querySelectorAll('p')); // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/19597#issuecomment-378218432 function issue_19597_378218432() { const myDiv = $(document.createElement('div')); // $ExpectType JQuery myDiv; myDiv.on('click', (evt) => { const target = evt.target; // $ExpectType HTMLDivElement target; }); const myDiv1 = $(document.createElement('div')); const myForcedDiv: JQuery = $(document.createElement('div')) as any; myForcedDiv.on('click', (evt) => { const target = evt.target; // HTMLDivElement // $ExpectType HTMLDivElement target; }); const myDoc = $(document); // $ExpectType JQuery myDoc; myDoc.on('click', (evt) => { const target = evt.target; // $ExpectType Document target; }); const myDocForced: JQuery = $(document); const myWindowForced: JQuery = $(window); // $ExpectType JQuery myWindowForced; } } function ajax() { // $ExpectType jqXHR $.ajax('url', { cache: true }); } function ajaxPrefilter() { // $ExpectType void $.ajaxPrefilter('dataTypes', (options, originalOptions, jqXHR) => { // $ExpectType AjaxSettings options; // $ExpectType AjaxSettings originalOptions; // $ExpectType jqXHR jqXHR; return 'filtered'; }); // $ExpectType void $.ajaxPrefilter('dataTypes', (options, originalOptions, jqXHR) => { // $ExpectType AjaxSettings options; // $ExpectType AjaxSettings originalOptions; // $ExpectType jqXHR jqXHR; }); // $ExpectType void $.ajaxPrefilter((options, originalOptions, jqXHR) => { // $ExpectType AjaxSettings options; // $ExpectType AjaxSettings originalOptions; // $ExpectType jqXHR jqXHR; return 'filtered'; }); // $ExpectType void $.ajaxPrefilter((options, originalOptions, jqXHR) => { // $ExpectType AjaxSettings options; // $ExpectType AjaxSettings originalOptions; // $ExpectType jqXHR jqXHR; }); } function ajaxSetup() { // $ExpectType AjaxSettings $.ajaxSetup({ cache: true }); } function ajaxTransport() { // $ExpectType void $.ajaxTransport('dataTypes', (options, originalOptions, jqXHR) => { // $ExpectType AjaxSettings options; // $ExpectType AjaxSettings originalOptions; // $ExpectType jqXHR jqXHR; return { send(headers, completeCallback) { // $ExpectType PlainObject headers; // $ExpectType SuccessCallback completeCallback; }, abort() { } }; }); // $ExpectType void $.ajaxTransport('dataTypes', (options, originalOptions, jqXHR) => { // $ExpectType AjaxSettings options; // $ExpectType AjaxSettings originalOptions; // $ExpectType jqXHR jqXHR; }); } function camelCase() { // $ExpectType string $.camelCase('foo-bar'); } function cleanData() { const elems: ArrayLike = {} as any; // $ExpectType void $.cleanData(elems); } function contains() { // $ExpectType boolean $.contains(new HTMLElement(), new HTMLElement()); } function css() { // $ExpectType any $.css(new HTMLElement(), 'borderRadius'); } function data() { const element: Element | Document | Window | JQuery.PlainObject = {} as any; const value: string | undefined = {} as any; // $ExpectError $.data(element, 'myKey', value); // $ExpectType "myValue" $.data(element, 'myKey', 'myValue'); // $ExpectType any $.data(element, 'myKey', undefined); // $ExpectType any $.data(element, 'myKey'); // $ExpectType any $.data(element); } function dequeue() { // $ExpectType void $.dequeue(new HTMLElement(), 'myQueue'); // $ExpectType void $.dequeue(new HTMLElement()); } function each() { // $ExpectType ArrayLike $.each(['myVal1', 'myVal2'], function(index, val) { // $ExpectType string this; // $ExpectType number index; // $ExpectType string val; return false; }); // $ExpectType ArrayLike $.each(['myVal1', 'myVal2'], function(index, val) { // $ExpectType string this; // $ExpectType number index; // $ExpectType string val; return 10; }); // $ExpectType ArrayLike $.each(['myVal1', 'myVal2'], function(index, val) { // $ExpectType string this; // $ExpectType number index; // $ExpectType string val; }); // $ExpectType { myVal1: boolean; myVal2: () => 10; myVal3: string; } $.each({ myVal1: false, myVal2: () => { return 10; }, myVal3: 'myVal3' }, function(propertyName, valueOfProperty) { // $ExpectType string | boolean | (() => 10) this; // $ExpectType "myVal1" | "myVal2" | "myVal3" propertyName; // $ExpectType string | boolean | (() => 10) valueOfProperty; return false; }); // $ExpectType { myVal1: boolean; myVal2: () => 10; myVal3: string; } $.each({ myVal1: false, myVal2: () => { return 10; }, myVal3: 'myVal3' }, function(propertyName, valueOfProperty) { // $ExpectType string | boolean | (() => 10) this; // $ExpectType "myVal1" | "myVal2" | "myVal3" propertyName; // $ExpectType string | boolean | (() => 10) valueOfProperty; return 10; }); // $ExpectType { myVal1: boolean; myVal2: () => 10; myVal3: string; } $.each({ myVal1: false, myVal2: () => { return 10; }, myVal3: 'myVal3' }, function(propertyName, valueOfProperty) { // $ExpectType string | boolean | (() => 10) this; // $ExpectType "myVal1" | "myVal2" | "myVal3" propertyName; // $ExpectType string | boolean | (() => 10) valueOfProperty; }); } function error() { jQuery.error = console.error; } function escapeSelector() { // $ExpectType string $.escapeSelector('span'); } function extend() { const t = { name: 'myObj' }; const u = new EventTarget(); const v = new Node(); const w = new Comment(); const x = new Text(); const y = new Element(); const z = new HTMLElement(); const a = new SVGElement(); // $ExpectType { name: string; } & EventTarget & Node & Comment & Text & Element & HTMLElement $.extend(true, t, u, v, w, x, y, z); // $ExpectType { name: string; } & EventTarget & Node & Comment & Text & Element $.extend(true, t, u, v, w, x, y); // $ExpectType { name: string; } & EventTarget & Node & Comment & Text $.extend(true, t, u, v, w, x); // $ExpectType { name: string; } & EventTarget & Node & Comment $.extend(true, t, u, v, w); // $ExpectType { name: string; } & EventTarget & Node $.extend(true, t, u, v); // $ExpectType { name: string; } & EventTarget $.extend(true, t, u); // $ExpectType JQueryStatic & { name: string; } $.extend(true, t); // $ExpectType any $.extend(true, t, u, v, w, x, y, z, a); // $ExpectType { name: string; } & EventTarget & Node & Comment & Text & Element & HTMLElement $.extend(t, u, v, w, x, y, z); // $ExpectType { name: string; } & EventTarget & Node & Comment & Text & Element $.extend(t, u, v, w, x, y); // $ExpectType { name: string; } & EventTarget & Node & Comment & Text $.extend(t, u, v, w, x); // $ExpectType { name: string; } & EventTarget & Node & Comment $.extend(t, u, v, w); // $ExpectType { name: string; } & EventTarget & Node $.extend(t, u, v); // $ExpectType { name: string; } & EventTarget $.extend(t, u); // $ExpectType JQueryStatic & { name: string; } $.extend(t); // $ExpectType any $.extend(t, u, v, w, x, y, z, a); } function get() { // $ExpectType jqXHR $.get('url', { myData: 'myData' }, (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.get('url', 'myData', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.get('url', { myData: 'myData' }, null, 'script'); // $ExpectType jqXHR $.get('url', 'myData', null, 'script'); // $ExpectType jqXHR $.get('url', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.get('url', null, 'script'); // $ExpectType jqXHR $.get('url', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.get('url', { myData: 'myData' }); // $ExpectType jqXHR $.get('url', 'myData'); // $ExpectType jqXHR $.get('url'); // $ExpectType jqXHR $.get({ url: 'url' }); // $ExpectType jqXHR $.get(); } function getJSON() { // $ExpectType jqXHR $.getJSON('url', { myVal1: 'myVal1' }, (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType jqXHR $.getJSON('url', 'myVal1', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType jqXHR $.getJSON('url', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType jqXHR $.getJSON('url', { myVal1: 'myVal1' }); // $ExpectType jqXHR $.getJSON('url', 'myVal1'); // $ExpectType jqXHR $.getJSON('url'); } function getScript() { // $ExpectType jqXHR $.getScript('url', (data, textStatus, jqXHR) => { // $ExpectType string | undefined data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType jqXHR $.getScript({ url: 'url', }); } function globalEval() { // $ExpectType void $.globalEval('throw new Error();'); } function grep() { // $ExpectType string[] $.grep(['myVal1', 'myVal2'], (elementOfArray, indexInArray) => { // $ExpectType string elementOfArray; // $ExpectType number indexInArray; return true; }, true); // $ExpectType string[] $.grep(['myVal1', 'myVal2'], (elementOfArray, indexInArray) => { // $ExpectType string elementOfArray; // $ExpectType number indexInArray; return true; }); } function hasData() { const element: Element | Document | Window | JQuery.PlainObject = {} as any; // $ExpectType boolean $.hasData(element); } function holdReady() { // $ExpectType void $.holdReady(true); } function htmlPrefilter() { // $ExpectType string $.htmlPrefilter(''); } function inArray() { // $ExpectType number $.inArray(1, [1, 2], 1); // $ExpectType number $.inArray(1, [1, 2]); } function isArray() { function type_guard(obj: object) { if ($.isArray(obj)) { // $ExpectType any[] obj; } else { // $ExpectType object obj; } } } function isEmptyObject() { // $ExpectType boolean $.isEmptyObject({}); } function isFunction() { function type_guard(obj: object) { if ($.isFunction(obj)) { // $ExpectType Function obj; } else { // $ExpectType object obj; } } } function isNumeric() { // $ExpectType boolean $.isNumeric(123); // true // $ExpectType boolean $.isNumeric(0 / 0); // false // $ExpectType boolean $.isNumeric('123'); // true // $ExpectType boolean $.isNumeric('1s3'); // false } function isPlainObject() { // $ExpectType boolean $.isPlainObject({}); // true // $ExpectType boolean $.isPlainObject(new Object()); // true // $ExpectType boolean $.isPlainObject(document); // false // $ExpectType boolean $.isPlainObject(Object.create(null)); // true } function isWindow() { function type_guard(obj: object) { if ($.isWindow(obj)) { // $ExpectType Window obj; } else { // $ExpectType object obj; } } } function isXMLDoc() { // $ExpectType boolean $.isXMLDoc(new Node()); } function makeArray() { // $ExpectType number[] $.makeArray([1, 2]); } function map() { // $ExpectType number[] $.map([1, 2, 3], function(elementOfArray, indexInArray) { // $ExpectType Window this; // $ExpectType number elementOfArray; // $ExpectType number indexInArray; return 200 + 10; }); // $ExpectType number[] $.map([1, 2, 3], function(elementOfArray, indexInArray) { // $ExpectType Window this; // $ExpectType number elementOfArray; // $ExpectType number indexInArray; return [200, 10]; }); // $ExpectType (number | null)[] $.map([1, 2, 3], function(elementOfArray, indexInArray) { // $ExpectType Window this; // $ExpectType number elementOfArray; // $ExpectType number indexInArray; return [200, 10, null]; }); // $ExpectType (number | undefined)[] $.map([1, 2, 3], function(elementOfArray, indexInArray) { // $ExpectType Window this; // $ExpectType number elementOfArray; // $ExpectType number indexInArray; return [200, 10, undefined]; }); // $ExpectType (false | 1)[] $.map({ myProp: true, name: 'Rogers', }, function(propertyOfObject, key) { // $ExpectType Window this; // $ExpectType string | boolean propertyOfObject; // $ExpectType "myProp" | "name" key; switch (key) { case 'myProp': return 1; case 'name': return false; } }); // $ExpectType (string | number | boolean)[] $.map({ myProp: true, name: 'Rogers', }, function(propertyOfObject, key) { // $ExpectType Window this; // $ExpectType string | boolean propertyOfObject; // $ExpectType "myProp" | "name" key; return [propertyOfObject, 24]; }); // $ExpectType (false | 1)[] $.map({ myProp: true, name: 'Rogers', anotherProp: 70, }, function(propertyOfObject, key) { // $ExpectType Window this; // $ExpectType string | number | boolean propertyOfObject; // $ExpectType "myProp" | "name" | "anotherProp" key; switch (key) { case 'myProp': return 1; case 'name': return false; } return null; }); // $ExpectType (false | 1)[] $.map({ myProp: true, name: 'Rogers', anotherProp: 70, }, function(propertyOfObject, key) { // $ExpectType Window this; // $ExpectType string | number | boolean propertyOfObject; // $ExpectType "myProp" | "name" | "anotherProp" key; switch (key) { case 'myProp': return 1; case 'name': return false; } return undefined; }); } function merge() { // $ExpectType (string | number)[] $.merge([1, 2, 3], ['myVal1', 'myVal2']); } function noConflict() { // $ExpectType JQueryStatic $.noConflict(true); // $ExpectType JQueryStatic $.noConflict(); } function nodeName() { const node: Node = undefined!; // $ExpectType boolean $.nodeName(node, 'name'); } function noop() { // $ExpectType undefined $.noop(); } function now() { // $ExpectType number $.now(); } function param() { // $ExpectType string $.param([true, 20], true); // $ExpectType string $.param({ myVal1: true, myVal2: 20 }, true); // $ExpectType string $.param($('input'), true); // $ExpectType string $.param([true, 20]); // $ExpectType string $.param({ myVal1: true, myVal2: 20 }); // $ExpectType string $.param($('input')); } function parseHTML() { // $ExpectType Node[] $.parseHTML('', document, true); // $ExpectType Node[] $.parseHTML('', null, true); // $ExpectType Node[] $.parseHTML('', undefined, true); // $ExpectType Node[] $.parseHTML('', document); // $ExpectType Node[] $.parseHTML('', null); // $ExpectType Node[] $.parseHTML('', undefined); // $ExpectType Node[] $.parseHTML('', false); // $ExpectType Node[] $.parseHTML(''); } function parseJSON() { // $ExpectType any $.parseJSON('{}'); } function parseXML() { // $ExpectType XMLDocument $.parseXML(''); } function post() { // $ExpectType jqXHR $.post('url', { myData: 'myData' }, (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.post('url', 'myData', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.post('url', { myData: 'myData' }, null, 'script'); // $ExpectType jqXHR $.post('url', 'myData', null, 'script'); // $ExpectType jqXHR $.post('url', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.post('url', null, 'script'); // $ExpectType jqXHR $.post('url', (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 'script'); // $ExpectType jqXHR $.post('url', { myData: 'myData' }); // $ExpectType jqXHR $.post('url', 'myData'); // $ExpectType jqXHR $.post('url'); // $ExpectType jqXHR $.post({ url: 'url' }); // $ExpectType jqXHR $.post(); } function proxy() { interface JContext { kind: 'JContext'; } interface J1 { kind: 'J1'; } interface J2 { kind: 'J2'; } interface J3 { kind: 'J3'; } interface J4 { kind: 'J4'; } interface J5 { kind: 'J5'; } interface J6 { kind: 'J6'; } interface J7 { kind: 'J7'; } interface J8 { kind: 'J8'; } const context: JContext = {} as any; const a: J8 = {} as any; const b: J7 = {} as any; const c: J6 = {} as any; const d: J5 = {} as any; const e: J4 = {} as any; const f: J3 = {} as any; const g: J2 = {} as any; const h: J1 = {} as any; type A = typeof a; type B = typeof b; type C = typeof c; type D = typeof d; type E = typeof e; type F = typeof f; type G = typeof g; // (funсtion, null) { // $ExpectType () => void $.proxy((a, b, c, d, e, f, g) => { }, null, a, b, c, d, e, f, g); // $ExpectType () => void $.proxy((a, b, c, d, e, f) => { }, null, a, b, c, d, e, f); // $ExpectType () => void $.proxy((a, b, c, d, e) => { }, null, a, b, c, d, e); // $ExpectType () => void $.proxy((a, b, c, d) => { }, null, a, b, c, d); // $ExpectType () => void $.proxy((a, b, c) => { }, null, a, b, c); // $ExpectType () => void $.proxy((a, b) => { }, null, a, b); // $ExpectType () => void $.proxy((a) => { }, null, a); // $ExpectType () => void $.proxy(() => { }, null); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1) => { }, null, a, b, c, d, e); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, t: J1) => { }, null, a, b, c, d); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, t: J1) => { }, null, a, b, c); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, t: J1) => { }, null, a, b); // $ExpectType (t: J1) => void $.proxy((a: A, t: J1) => { }, null, a); // $ExpectType (t: J1) => void $.proxy((t: J1) => { }, null); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2) => { }, null, a, b, c, d, e); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2) => { }, null, a, b, c, d); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2) => { }, null, a, b, c); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, t: J1, u: J2) => { }, null, a, b); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, t: J1, u: J2) => { }, null, a); // $ExpectType (t: J1, u: J2) => void $.proxy((t: J1, u: J2) => { }, null); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3) => { }, null, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3) => { }, null, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3) => { }, null, a, b, c); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3) => { }, null, a, b); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, t: J1, u: J2, v: J3) => { }, null, a); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((t: J1, u: J2, v: J3) => { }, null); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4) => { }, null, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4) => { }, null, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((t: J1, u: J2, v: J3, w: J4) => { }, null); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5) => { }, null); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, null); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, null); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null); // $ExpectType (...args: any[]) => void $.proxy((a, b, c, d, e, f, g, h, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, null, a, b, c, d, e, f, g, h); } // (funсtion, undefined) { // $ExpectType () => void $.proxy((a, b, c, d, e, f, g) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType () => void $.proxy((a, b, c, d, e, f) => { }, undefined, a, b, c, d, e, f); // $ExpectType () => void $.proxy((a, b, c, d, e) => { }, undefined, a, b, c, d, e); // $ExpectType () => void $.proxy((a, b, c, d) => { }, undefined, a, b, c, d); // $ExpectType () => void $.proxy((a, b, c) => { }, undefined, a, b, c); // $ExpectType () => void $.proxy((a, b) => { }, undefined, a, b); // $ExpectType () => void $.proxy((a) => { }, undefined, a); // $ExpectType () => void $.proxy(() => { }, undefined); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, d: D, t: J1) => { }, undefined, a, b, c, d); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, c: C, t: J1) => { }, undefined, a, b, c); // $ExpectType (t: J1) => void $.proxy((a: A, b: B, t: J1) => { }, undefined, a, b); // $ExpectType (t: J1) => void $.proxy((a: A, t: J1) => { }, undefined, a); // $ExpectType (t: J1) => void $.proxy((t: J1) => { }, undefined); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2) => { }, undefined, a, b, c, d); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2) => { }, undefined, a, b, c); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, b: B, t: J1, u: J2) => { }, undefined, a, b); // $ExpectType (t: J1, u: J2) => void $.proxy((a: A, t: J1, u: J2) => { }, undefined, a); // $ExpectType (t: J1, u: J2) => void $.proxy((t: J1, u: J2) => { }, undefined); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3) => { }, undefined, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3) => { }, undefined, a, b, c); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3) => { }, undefined, a, b); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((a: A, t: J1, u: J2, v: J3) => { }, undefined, a); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy((t: J1, u: J2, v: J3) => { }, undefined); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4) => { }, undefined, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy((t: J1, u: J2, v: J3, w: J4) => { }, undefined); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5) => { }, undefined); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => { }, undefined); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) => { }, undefined); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy((t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined); // $ExpectType (...args: any[]) => void $.proxy((a, b, c, d, e, f, g, h, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) => { }, undefined, a, b, c, d, e, f, g, h); } // (funсtion, context) { // $ExpectType () => void $.proxy(function(a, b, c, d, e, f, g) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType () => void $.proxy(function(a, b, c, d, e, f) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType () => void $.proxy(function(a, b, c, d, e) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType () => void $.proxy(function(a, b, c, d) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType () => void $.proxy(function(a, b, c) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType () => void $.proxy(function(a, b) { // $ExpectType JContext this; }, context, a, b); // $ExpectType () => void $.proxy(function(a) { // $ExpectType JContext this; }, context, a); // $ExpectType () => void $.proxy(function() { // $ExpectType JContext this; }, context); // $ExpectType (t: J1) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1) => void $.proxy(function(a: A, b: B, c: C, t: J1) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1) => void $.proxy(function(a: A, b: B, t: J1) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1) => void $.proxy(function(a: A, t: J1) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1) => void $.proxy(function(t: J1) { // $ExpectType JContext this; }, context); // $ExpectType (t: J1, u: J2) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1, u: J2) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1, u: J2) => void $.proxy(function(a: A, b: B, c: C, t: J1, u: J2) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1, u: J2) => void $.proxy(function(a: A, b: B, t: J1, u: J2) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1, u: J2) => void $.proxy(function(a: A, t: J1, u: J2) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1, u: J2) => void $.proxy(function(t: J1, u: J2) { // $ExpectType JContext this; }, context); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(a: A, t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1, u: J2, v: J3) => void $.proxy(function(t: J1, u: J2, v: J3) { // $ExpectType JContext this; }, context); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4) => void $.proxy(function(t: J1, u: J2, v: J3, w: J4) { // $ExpectType JContext this; }, context); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5) => void $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5) { // $ExpectType JContext this; }, context); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) => void $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5, y: J6) { // $ExpectType JContext this; }, context); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7) { // $ExpectType JContext this; }, context); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, g: G, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, f: F, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a, b, c, d, e, f); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, e: E, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a, b, c, d, e); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, d: D, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a, b, c, d); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, c: C, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a, b, c); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, b: B, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a, b); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(a: A, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a); // $ExpectType (t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, ...args: any[]) => void $.proxy(function(t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context); // $ExpectType (...args: any[]) => void $.proxy(function(a, b, c, d, e, f, g, h, t: J1, u: J2, v: J3, w: J4, x: J5, y: J6, z: J7, _: J8) { // $ExpectType JContext this; }, context, a, b, c, d, e, f, g, h); } // $ExpectType (...args: any[]) => any $.proxy({ myFunc: $.noop }, 'myFunc', 1, 2); // $ExpectType (...args: any[]) => any $.proxy({ myFunc: $.noop }, 'myFunc'); } function queue() { // $ExpectType Queue $.queue(new HTMLElement(), 'myQueue', function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; }); // $ExpectType Queue $.queue(new HTMLElement(), 'myQueue', [function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; }]); // $ExpectType Queue $.queue(new HTMLElement(), 'myQueue'); // $ExpectType Queue $.queue(new HTMLElement()); } function readyException() { jQuery.readyException = (error) => { console.error(error); }; } function removeData() { const element: Element | Document | Window | JQuery.PlainObject = {} as any; // $ExpectType void $.removeData(element, 'test1'); // $ExpectType void $.removeData(element); } function speed() { // $ExpectType EffectsOptions $.speed(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType EffectsOptions $.speed(5000, 'linear'); // $ExpectType EffectsOptions $.speed(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType EffectsOptions $.speed(5000); // $ExpectType EffectsOptions $.speed(function() { // $ExpectType HTMLElement this; }); // $ExpectType EffectsOptions $.speed({ duration: 5000, easing: 'linear', complete() { // $ExpectType HTMLElement this; } }); // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. // $ExpectError $.speed(false); // $ExpectType EffectsOptions $.speed(); } function trim() { // $ExpectType string $.trim('myStr'); } function type() { // // $ExpectType "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" | "array" | "date" | "error" | "null" | "regexp" // $.type({}); } function unique() { // $ExpectType HTMLElement[] $.unique([new HTMLElement()]); } function uniqueSort() { // $ExpectType HTMLElement[] $.uniqueSort([new HTMLElement()]); } function when() { interface J1 { kind: 'J1'; } interface J2 { kind: 'J2'; } interface J3 { kind: 'J3'; } interface J4 { kind: 'J4'; } interface J5 { kind: 'J5'; } interface J6 { kind: 'J6'; } interface J7 { kind: 'J7'; } interface J8 { kind: 'J8'; } interface J9 { kind: 'J9'; } function Promise3() { const t = $.ajax() as JQuery.jqXHR; const u = $.ajax() as JQuery.jqXHR; const v = $.ajax() as JQuery.jqXHR; // // 3 parameters // { // const w = $.when(t, u, v); // // w.then((a, b, c) => { // a[0]; // $ExpectType string // a[1]; // $ExpectType SuccessTextStatus // a[2]; // $ExpectType jqXHR // b[0]; // $ExpectType number // b[1]; // $ExpectType SuccessTextStatus // b[2]; // $ExpectType jqXHR // c[0]; // $ExpectType boolean // c[1]; // $ExpectType SuccessTextStatus // c[2]; // $ExpectType jqXHR // }, (a, b, c) => { // a[0]; // $ExpectType jqXHR // a[1]; // $ExpectType ErrorTextStatus // a[2]; // $ExpectType string // b[0]; // $ExpectType jqXHR // b[1]; // $ExpectType ErrorTextStatus // b[2]; // $ExpectType string // c[0]; // $ExpectType jqXHR // c[1]; // $ExpectType ErrorTextStatus // c[2]; // $ExpectType string // }, (a, b, c) => { // a; // $ExpectType never // b; // $ExpectType never // c; // $ExpectType never // }); // } // // // 2 parameters // { // const w = $.when(t, u); // // w.then((a, b) => { // a[0]; // $ExpectType string // a[1]; // $ExpectType SuccessTextStatus // a[2]; // $ExpectType jqXHR // b[0]; // $ExpectType number // b[1]; // $ExpectType SuccessTextStatus // b[2]; // $ExpectType jqXHR // }, (a, b) => { // a[0]; // $ExpectType jqXHR // a[1]; // $ExpectType ErrorTextStatus // a[2]; // $ExpectType string // b[0]; // $ExpectType jqXHR // b[1]; // $ExpectType ErrorTextStatus // b[2]; // $ExpectType string // }, (a, b) => { // a; // $ExpectType never // b; // $ExpectType never // }); // } // 1 parameter { const w = $.when(t); w.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType SuccessTextStatus c; // $ExpectType jqXHR }, (a, b, c) => { a; // $ExpectType jqXHR b; // $ExpectType ErrorTextStatus c; // $ExpectType string }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never c; // $ExpectType never }); } } function Promise2() { const t: JQuery.Promise2 = {} as any; const u: JQuery.Promise2 = {} as any; const v: JQuery.Promise2 = {} as any; // // 3 parameters // { // const w = $.when(t, u, v); // // w.then((a, b, c) => { // a[0]; // $ExpectType string // a[1]; // $ExpectType boolean // b[0]; // $ExpectType string // b[1]; // $ExpectType boolean // c[0]; // $ExpectType string // c[1]; // $ExpectType boolean // }, (a, b, c) => { // a[0]; // $ExpectType Error // a[1]; // $ExpectType any // b[0]; // $ExpectType Error // b[1]; // $ExpectType any // c[0]; // $ExpectType Error // c[1]; // $ExpectType any // }, (a, b, c) => { // a; // $ExpectType never // b; // $ExpectType never // c; // $ExpectType never // }); // } // // // 2 parameters // { // const w = $.when(t, u); // // w.then((a, b) => { // a[0]; // $ExpectType string // a[1]; // $ExpectType boolean // b[0]; // $ExpectType string // b[1]; // $ExpectType boolean // }, (a, b) => { // a[0]; // $ExpectType Error // a[1]; // $ExpectType any // b[0]; // $ExpectType Error // b[1]; // $ExpectType any // }, (a, b) => { // a; // $ExpectType never // b; // $ExpectType never // }); // } // 1 parameter { const w = $.when(t); w.then((a, b) => { a; // $ExpectType string b; // $ExpectType boolean }, (a, b) => { a; // $ExpectType Error b; // $ExpectType any }, (a, b) => { a; // $ExpectType never b; // $ExpectType never }); } } function Promise() { const p1: JQuery.Promise = {} as any; const p2: JQuery.Promise = {} as any; const p3: JQuery.Promise = {} as any; // 3 parameters { const w = $.when(p1, p2, p3); w.then((a, b, c) => { a; // $ExpectType J1 b; // $ExpectType J2 c; // $ExpectType J3 }, (a, b, c) => { a; // $ExpectType J2 b; // $ExpectType J3 c; // $ExpectType J4 }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never c; // $ExpectType never }); } // 2 parameters { const w = $.when(p1, p2); w.then((a, b) => { a; // $ExpectType J1 b; // $ExpectType J2 }, (a, b) => { a; // $ExpectType J2 b; // $ExpectType J3 }, (a, b) => { a; // $ExpectType never b; // $ExpectType never }); } // 1 parameter { const w = $.when(p1); w.then(a => { a; // $ExpectType J1 }, a => { a; // $ExpectType J2 }, a => { a; // $ExpectType never }); } } function Thenable() { const t1: JQuery.Thenable = {} as any; const t2: JQuery.Thenable = {} as any; const t3: JQuery.Thenable = {} as any; // 3 parameters { const w = $.when(t1, t2, t3); w.then((a, b, c) => { a; // $ExpectType J1 b; // $ExpectType J2 c; // $ExpectType J3 }, (a, b, c) => { a; // $ExpectType any b; // $ExpectType any c; // $ExpectType any }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never c; // $ExpectType never }); } // 2 parameters { const w = $.when(t1, t2); w.then((a, b) => { a; // $ExpectType J1 b; // $ExpectType J2 }, (a, b) => { a; // $ExpectType any b; // $ExpectType any }, (a, b) => { a; // $ExpectType never b; // $ExpectType never }); } // 1 parameter { const w = $.when(t1); w.then(a => { a; // $ExpectType J1 }, a => { a; // $ExpectType any }, a => { a; // $ExpectType never }); } } function value() { const w = $.when('myVal1'); w.then(a => { a; // $ExpectType string }); } function Zero() { const w = $.when(); w.then(a => { a; // $ExpectType never }, a => { a; // $ExpectType never }, a => { a; // $ExpectType never }); } // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/2725 function issue_2725() { function first() { return $.when('1'); } $.when().then(() => { return first(); }).then((value) => { value; // $ExpectType string }); } // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/10159 function issue_10159() { interface One { result: number; } interface Two { Result: number; } interface Three { TheResult: number; } class AsyncRunner { Run(): void { const task1 = this.runTask1(); const task2 = this.runTask2(); const task3 = this.runTask3(); $.when(task1, task2, task3) .then((r1, r2, r3) => { r1; // $ExpectType One r2; // $ExpectType Two r3; // $ExpectType Three }); } runTask1() { const dfd = $.Deferred(); console.log('Task 1'); setTimeout(() => { dfd.resolve({ result: 1 }); }, Math.floor(400 + Math.random() * 2000)); return dfd.promise(); } runTask2() { const dfd = $.Deferred(); console.log('Task 2'); setTimeout(() => { dfd.resolve({ Result: 2 }); }, Math.floor(400 + Math.random() * 2000)); return dfd.promise(); } runTask3() { const dfd = $.Deferred(); console.log('Task 3'); setTimeout(() => { dfd.resolve({ TheResult: 3 }); }, Math.floor(400 + Math.random() * 2000)); return dfd.promise(); } } } } } function JQuery() { function type_annotation() { const $canvas: JQuery = $(document.createElement('canvas')); } function iterable() { for (const a of $('div')) { a.textContent = 'myDiv'; } } function arrayLike() { // $ExpectType HTMLElement $('div')[0]; $('div')[0] = new HTMLElement(); } function ajax() { function ajaxComplete() { // $ExpectType JQuery $(document).ajaxComplete(function(event, jqXHR, ajaxOptions) { // $ExpectType Document this; // $ExpectType TriggeredEvent event; // $ExpectType jqXHR jqXHR; // $ExpectType AjaxSettings ajaxOptions; return false; }); } function ajaxError() { // $ExpectType JQuery $(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) { // $ExpectType Document this; // $ExpectType TriggeredEvent event; // $ExpectType jqXHR jqXHR; // $ExpectType AjaxSettings ajaxSettings; // $ExpectType string thrownError; return false; }); } function ajaxSend() { // $ExpectType JQuery $(document).ajaxSend(function(event, jqXHR, ajaxOptions) { // $ExpectType Document this; // $ExpectType TriggeredEvent event; // $ExpectType jqXHR jqXHR; // $ExpectType AjaxSettings ajaxOptions; return false; }); } function ajaxStart() { // $ExpectType JQuery $(document).ajaxStart(function() { // $ExpectType Document this; return false; }); } function ajaxStop() { // $ExpectType JQuery $(document).ajaxStop(function() { // $ExpectType Document this; return false; }); } function ajaxSuccess() { // $ExpectType JQuery $(document).ajaxSuccess(function(event, jqXHR, ajaxOptions, data) { // $ExpectType Document this; // $ExpectType TriggeredEvent event; // $ExpectType jqXHR jqXHR; // $ExpectType AjaxSettings ajaxOptions; // $ExpectType PlainObject data; return false; }); } function load() { // $ExpectType JQuery $('#result').load('/echo/html/', 'data', function(responseText, textStatus, jqXHR) { // $ExpectType HTMLElement this; // $ExpectType string responseText; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType JQuery $('#result').load('/echo/html/', { data: 'data' }, function(responseText, textStatus, jqXHR) { // $ExpectType HTMLElement this; // $ExpectType string responseText; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType JQuery $('#result').load('/echo/html/', function(responseText, textStatus, jqXHR) { // $ExpectType HTMLElement this; // $ExpectType string responseText; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType JQuery $('#result').load('/echo/html/', 'data'); // $ExpectType JQuery $('#result').load('/echo/html/', { data: 'data' }); } } function attributes() { function attr() { // $ExpectType JQuery $('#greatphoto').attr('alt', 'Beijing Brush Seller'); // $ExpectType JQuery $('#greatphoto').attr('width', 200); // $ExpectType JQuery $('#greatphoto').attr('title', null); // $ExpectType JQuery $('#greatphoto').attr('alt', function(index, attr) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string attr; return 'Beijing Brush Seller'; }); // $ExpectType JQuery $('#greatphoto').attr('width', function(index, attr) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string attr; return 200; }); // $ExpectType JQuery $('#greatphoto').attr('title', function(index, attr) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string attr; }); // $ExpectType JQuery $('#greatphoto').attr('title', function(index, attr) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string attr; return undefined; }); // $ExpectType JQuery $('img').attr({ src: '/resources/hat.gif', title: 'jQuery', alt: 'jQuery Logo' }); // $ExpectType string | undefined $('img').attr('src'); } function removeAttr() { // $ExpectType JQuery $('#greatphoto').removeAttr('alt'); } } function properties() { function prop() { // $ExpectType JQuery $('p').prop('myProp', function(index, oldPropertyValue) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType any oldPropertyValue; return {}; }); // $ExpectType JQuery $('p').prop('myProp', {}); // $ExpectType JQuery $('input[type=\'checkbox\']').prop({ myProp: true }); // $ExpectType any $('input[type=\'checkbox\']').prop('myProp'); } function removeProp() { // $ExpectType JQuery $('p').removeProp('luggageCode'); } } function css() { // TODO: .css() getters can return 'undefined' for properties that don't exist. Consider changing the return types to reflect this after adding specialized signatures. function css() { // $ExpectType JQuery $('p').css('cssProp', 'value'); // $ExpectType JQuery $('p').css('cssProp', 20); // $ExpectType JQuery $('p').css('cssProp', function(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; return 'value'; }); // $ExpectType JQuery $('p').css('cssProp', function(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; return 20; }); // $ExpectType JQuery $('p').css('cssProp', function(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; }); // $ExpectType JQuery $('p').css('cssProp', function(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; return undefined; }); // $ExpectType JQuery $('p').css({ myProp1: 'value', myProp2: 20, myProp3(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; return 'value'; }, myProp4(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; return 20; }, myProp5(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; }, myProp6(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; return undefined; } }); // $ExpectType string $('p').css('myProp'); // $ExpectType PlainObject $('p').css([ 'myProp1', 'myProp2' ]); } function height() { // $ExpectType JQuery $('p').height('200px'); // $ExpectType JQuery $('p').height(400); // $ExpectType JQuery $('p').height(function(index, height) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number height; return '200px'; }); // $ExpectType JQuery $('p').height(function(index, height) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number height; return 400; }); // $ExpectType number | undefined $('p').height(); } function innerHeight() { // $ExpectType JQuery $('p').innerHeight('200px'); // $ExpectType JQuery $('p').innerHeight(400); // $ExpectType JQuery $('p').innerHeight(function(index, height) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number height; return '200px'; }); // $ExpectType JQuery $('p').innerHeight(function(index, height) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number height; return 400; }); // $ExpectType number | undefined $('p').innerHeight(); } function outerHeight() { const value: string | number = undefined!; // $ExpectType JQuery $('p').outerHeight(value, true); // $ExpectType JQuery $('p').outerHeight('200px'); // $ExpectType JQuery $('p').outerHeight(400); // $ExpectType JQuery $('p').outerHeight(function(index, height) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number height; return '200px'; }, false); // $ExpectType JQuery $('p').outerHeight(function(index, height) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number height; return '200px'; }); // $ExpectType JQuery $('p').outerHeight(function(index, height) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number height; return 400; }); // $ExpectType number | undefined $('p').outerHeight(); // $ExpectType number | undefined $('p').outerHeight(true); } function width() { // $ExpectType JQuery $('p').width('200px'); // $ExpectType JQuery $('p').width(400); // $ExpectType JQuery $('p').width(function(index, width) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number width; return '200px'; }); // $ExpectType JQuery $('p').width(function(index, width) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number width; return 400; }); // $ExpectType number | undefined $('p').width(); } function innerWidth() { // $ExpectType JQuery $('p').innerWidth('200px'); // $ExpectType JQuery $('p').innerWidth(400); // $ExpectType JQuery $('p').innerWidth(function(index, width) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number width; return '200px'; }); // $ExpectType JQuery $('p').innerWidth(function(index, width) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number width; return 400; }); // $ExpectType number | undefined $('p').innerWidth(); } function outerWidth() { const value: string | number = undefined!; // $ExpectType JQuery $('p').outerWidth(value, true); // $ExpectType JQuery $('p').outerWidth('200px'); // $ExpectType JQuery $('p').outerWidth(400); // $ExpectType JQuery $('p').outerWidth(function(index, width) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number width; return '200px'; }, false); // $ExpectType JQuery $('p').outerWidth(function(index, width) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number width; return '200px'; }); // $ExpectType JQuery $('p').outerWidth(function(index, width) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType number width; return 400; }); // $ExpectType number | undefined $('p').outerWidth(); // $ExpectType number | undefined $('p').outerWidth(true); } function offset() { // $ExpectType JQuery $('p').offset({ left: 20, top: 50 }); // $ExpectType JQuery $('p').offset({ left: 20 }); // $ExpectType JQuery $('p').offset({}); // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. // $ExpectError $('p').offset(20); // $ExpectType JQuery $('p').offset(function(index, coords) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType Coordinates coords; return { left: 20, top: 50 }; }); // $ExpectType JQuery $('p').offset(function(index, coords) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType Coordinates coords; return { top: 50 }; }); // $ExpectType Coordinates | undefined $('p').offset(); } function position() { // $ExpectType Coordinates $('p').position(); } function scrollLeft() { // $ExpectType JQuery $('p').scrollLeft(200); // $ExpectType number | undefined $('p').scrollLeft(); } function scrollTop() { // $ExpectType JQuery $('p').scrollTop(200); // $ExpectType number | undefined $('p').scrollTop(); } function addClass() { // $ExpectType JQuery $('p').addClass('className'); // $ExpectType JQuery $('p').addClass(['dave', 'michał', 'oleg', 'richard', 'jason', 'timmy']); // $ExpectType JQuery $('p').addClass(function(index, currentClassName) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string currentClassName; return 'className'; }); } function hasClass() { // $ExpectType boolean $('p').hasClass('className'); } function removeClass() { // $ExpectType JQuery $('p').removeClass('className'); // $ExpectType JQuery $('p').removeClass(['dave', 'michał', 'oleg', 'richard', 'jason', 'timmy']); // $ExpectType JQuery $('p').removeClass(function(index, currentClassName) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string currentClassName; return 'className'; }); // $ExpectType JQuery $('p').removeClass(); } function toggleClass() { // $ExpectType JQuery $('p').toggleClass('className', true); // $ExpectType JQuery $('p').toggleClass('className'); // $ExpectType JQuery $('p').toggleClass(['dave', 'michał', 'oleg', 'richard', 'jason', 'timmy'], false); // $ExpectType JQuery $('p').toggleClass(['dave', 'michał', 'oleg', 'richard', 'jason', 'timmy']); // $ExpectType JQuery $('p').toggleClass(function(index, className, state) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string className; // $ExpectType true state; return 'className'; }, true); // $ExpectType JQuery $('p').toggleClass('className'); // $ExpectType JQuery $('p').toggleClass(function(index, className, state) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string className; // $ExpectType boolean state; return 'className'; }); // $ExpectType JQuery $('p').toggleClass(false); // $ExpectType JQuery $('p').toggleClass(); } } function data() { function data() { const value: string | undefined = {} as any; // $ExpectError $('p').data('myData', value); // $ExpectType JQuery $('p').data('myData', {}); // $ExpectType JQuery $('p').data({ myData1: {}, myData2: false }); // $ExpectType any $('p').data('myData', undefined); // $ExpectType any $('p').data('myData'); // $ExpectType PlainObject $('p').data(); } function removeData() { // $ExpectType JQuery $('p').removeData('myData'); // $ExpectType JQuery $('p').removeData([ 'myData1', 'myData2' ]); // $ExpectType JQuery $('p').removeData(); } } function effects() { function animate() { // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }, 5000, 'linear', function() { // $ExpectType HTMLElement this; $(this).after('
Animation complete.
'); }); // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }, 5000, 'linear'); // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }, 5000, function() { // $ExpectType HTMLElement this; $(this).after('
Animation complete.
'); }); // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }, 'linear', function() { // $ExpectType HTMLElement this; $(this).after('
Animation complete.
'); }); // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }, 5000); // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }, 'linear'); // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }, function() { // $ExpectType HTMLElement this; $(this).after('
Animation complete.
'); }); // $ExpectType JQuery $('#book').animate({ width: 'toggle', height: 'toggle' }, { duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('#book').animate({ width: ['toggle', 'swing'], height: 200, opacity: 'toggle' }); } function fadeIn() { // $ExpectType JQuery $('p').fadeIn(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeIn(5000, 'linear'); // $ExpectType JQuery $('p').fadeIn(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeIn('linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeIn(5000); // $ExpectType JQuery $('p').fadeIn('linear'); // $ExpectType JQuery $('p').fadeIn(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeIn({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').fadeIn(); } function fadeOut() { // $ExpectType JQuery $('p').fadeOut(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeOut(5000, 'linear'); // $ExpectType JQuery $('p').fadeOut(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeOut('linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeOut(5000); // $ExpectType JQuery $('p').fadeOut('linear'); // $ExpectType JQuery $('p').fadeOut(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeOut({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').fadeOut(); } function fadeToggle() { // $ExpectType JQuery $('p').fadeToggle(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeToggle(5000, 'linear'); // $ExpectType JQuery $('p').fadeToggle(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeToggle('linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeToggle(5000); // $ExpectType JQuery $('p').fadeToggle('linear'); // $ExpectType JQuery $('p').fadeToggle(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeToggle({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').fadeToggle(); } function slideDown() { // $ExpectType JQuery $('p').slideDown(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideDown(5000, 'linear'); // $ExpectType JQuery $('p').slideDown(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideDown('linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideDown(5000); // $ExpectType JQuery $('p').slideDown('linear'); // $ExpectType JQuery $('p').slideDown(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideDown({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').slideDown(); } function slideToggle() { // $ExpectType JQuery $('p').slideToggle(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideToggle(5000, 'linear'); // $ExpectType JQuery $('p').slideToggle(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideToggle('linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideToggle(5000); // $ExpectType JQuery $('p').slideToggle('linear'); // $ExpectType JQuery $('p').slideToggle(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideToggle({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').slideToggle(); } function slideUp() { // $ExpectType JQuery $('p').slideUp(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideUp(5000, 'linear'); // $ExpectType JQuery $('p').slideUp(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideUp('linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideUp(5000); // $ExpectType JQuery $('p').slideUp('linear'); // $ExpectType JQuery $('p').slideUp(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').slideUp({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').slideUp(); } function fadeTo() { // $ExpectType JQuery $('p').fadeTo(5000, 0.9, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeTo(5000, 0.9, 'linear'); // $ExpectType JQuery $('p').fadeTo(5000, 0.9, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').fadeTo(5000, 0.9); } function toggle() { // $ExpectType JQuery $('p').toggle(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').toggle(5000, 'linear'); // $ExpectType JQuery $('p').toggle(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').toggle(5000); // $ExpectType JQuery $('p').toggle(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').toggle(true); // $ExpectType JQuery $('p').toggle(); } function hide() { // $ExpectType JQuery $('p').hide(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').hide(5000, 'linear'); // $ExpectType JQuery $('p').hide(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').hide(5000); // $ExpectType JQuery $('p').hide(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').hide({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').hide(); } function show() { // $ExpectType JQuery $('p').show(5000, 'linear', function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').show(5000, 'linear'); // $ExpectType JQuery $('p').show(5000, function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').show(5000); // $ExpectType JQuery $('p').show(function() { // $ExpectType HTMLElement this; }); // $ExpectType JQuery $('p').show({ duration: 5000, specialEasing: { width: 'linear', height: 'easeOutBounce' }, complete() { $(this).after('
Animation complete.
'); } }); // $ExpectType JQuery $('p').show(); } } function queue() { function clearQueue() { // $ExpectType JQuery $('p').clearQueue('myQueue'); // $ExpectType JQuery $('p').clearQueue(); } function delay() { // $ExpectType JQuery $('p').delay('fast', 'myQueue'); // $ExpectType JQuery $('p').delay('slow'); } function dequeue() { // $ExpectType JQuery $('p').dequeue('myQueue'); // $ExpectType JQuery $('p').dequeue(); } function finish() { // $ExpectType JQuery $('p').finish('myQueue'); // $ExpectType JQuery $('p').finish(); } function queue() { // $ExpectType JQuery $('p').queue('myQueue', function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; }); // $ExpectType JQuery $('p').queue('myQueue', [ function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; }, function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; } ]); // $ExpectType JQuery $('p').queue(function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; }); // $ExpectType JQuery $('p').queue([ function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; }, function(next) { // $ExpectType HTMLElement this; // $ExpectType () => void next; } ]); // $ExpectType Queue $('p').queue('myQueue'); // $ExpectType Queue $('p').queue(); } function stop() { // $ExpectType JQuery $('p').stop('myQueue', true, false); // $ExpectType JQuery $('p').stop('myQueue', true); // $ExpectType JQuery $('p').stop(true, false); // $ExpectType JQuery $('p').stop(true); } function promise() { // $ExpectType { description: string; } & Promise, any, any> $('p').promise('myQueue', { description: 'desc' }); // $ExpectType { description: string; } & Promise, any, any> $('p').promise({ description: 'desc' }); // $ExpectType Promise, any, any> $('p').promise(); } } function events() { // [bind() overloads] https://github.com/jquery/api.jquery.com/issues/1048 function bind() { // $ExpectType JQuery $('p').bind('myEvent', 'myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('p').bind('myEvent', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('p').bind('myEvent', false); // $ExpectType JQuery $('p').bind('myEvent', null); // $ExpectType JQuery $('p').bind('myEvent', undefined); // $ExpectType JQuery $('p').bind({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }); } function delegate() { // $ExpectType JQuery $('table').delegate('td', 'myEvent', 'myData', function(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').delegate('td', 'myEvent', function(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').delegate('td', 'myEvent', false); // $ExpectType JQuery $('table').delegate('td', { myEvent1: false, myEvent2(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType any this; // $ExpectType ClickEvent event; } }); } function off() { function defaultData(this: HTMLElement, event: JQuery.TriggeredEvent) { } function customData(this: HTMLElement, event: JQuery.TriggeredEvent) { } function specificEventType(this: HTMLElement, event: JQuery.MouseDownEvent) { } // $ExpectType JQuery $('table').off('myEvent', 'td', defaultData); // $ExpectType JQuery $('table').off('myEvent', 'td', customData); // $ExpectType JQuery $('table').off('mousedown', 'td', specificEventType); // $ExpectType JQuery $('table').off('myEvent', 'td', false); // $ExpectType JQuery $('table').off('myEvent', 'td'); // $ExpectType JQuery $('table').off('myEvent', defaultData); // $ExpectType JQuery $('table').off('myEvent', customData); // $ExpectType JQuery $('table').off('mousedown', specificEventType); // $ExpectType JQuery $('table').off('myEvent', false); // $ExpectType JQuery $('table').off('myEvent'); // $ExpectType JQuery $('table').off({ myEvent1: false, defaultData, customData }, 'td'); // $ExpectType JQuery $('table').off({ myEvent1: false, defaultData, customData }); const ev: JQuery.TriggeredEvent = undefined!; // $ExpectType JQuery $('table').off(ev); // $ExpectType JQuery $('table').off(); } function on() { $('table').on('myEvent', 'td', 'myData', function(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').on('myEvent', null, 'myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').on('myEvent', undefined, 'myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').on('myEvent', 'td', 'myData', function(event: JQueryEventObject) { // $ExpectType any this; // $ExpectType JQueryEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', null, 'myData', function(event: JQueryEventObject) { // TODO: Why is this HTMLElement? The callback signature doesn't even have `this` declared. // $ExpectType HTMLElement this; // $ExpectType JQueryEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', undefined, 'myData', function(event: JQueryEventObject) { // TODO: Why is this HTMLElement? The callback signature doesn't even have `this` declared. // $ExpectType HTMLElement this; // $ExpectType JQueryEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', 'td', function(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').on('myEvent', 'td', false); // $ExpectType JQuery $('table').on('myEvent', 3, function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').on('myEvent', 'td', function(event: JQueryEventObject) { // $ExpectType any this; // $ExpectType JQueryEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', 3, function(event: JQueryEventObject) { // $ExpectType HTMLElement this; // $ExpectType JQueryEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').on('myEvent', false); // $ExpectType JQuery $('table').on('myEvent', function(event: JQueryEventObject) { // $ExpectType HTMLElement this; // $ExpectType JQueryEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', function(event: JQueryInputEventObject) { // $ExpectType HTMLElement this; // $ExpectType JQueryInputEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', function(event: JQueryMouseEventObject) { // $ExpectType HTMLElement this; // $ExpectType JQueryMouseEventObject event; }); // $ExpectType JQuery $('table').on('myEvent', function(event: JQueryKeyEventObject) { // $ExpectType HTMLElement this; // $ExpectType JQueryKeyEventObject event; }); // $ExpectType JQuery $('table').on({ myEvent1: false, myEvent2(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType any this; // $ExpectType ClickEvent event; } }, 'td', 'myData'); // $ExpectType JQuery $('table').on({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }, null, 'myData'); // $ExpectType JQuery $('table').on({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }, undefined, 'myData'); // $ExpectType JQuery $('table').on({ myEvent1: false, myEvent2(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType any this; // $ExpectType ClickEvent event; } }, 'td'); // $ExpectType JQuery $('table').on({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }, 3); // $ExpectType JQuery $('table').on({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }); // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31124 function issue_31124(el: Element, mouseX: number) { $(el) .on("mousedown touchstart", (evt) => { // tslint:disable-next-line:prefer-conditional-expression if (evt.type === "mousedown") { mouseX = (evt.originalEvent as MouseEvent).clientX; } else { mouseX = (evt.originalEvent as TouchEvent).touches[0].clientX; } }); } } function one() { // $ExpectType JQuery $('table').one('myEvent', 'td', 'myData', function(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').one('myEvent', null, 'myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').one('myEvent', undefined, 'myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').one('myEvent', 'td', function(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').one('myEvent', 'td', false); // $ExpectType JQuery $('table').one('myEvent', 3, function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').one('myEvent', function(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }); // $ExpectType JQuery $('table').one('myEvent', false); // $ExpectType JQuery $('table').one({ myEvent1: false, myEvent2(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType any this; // $ExpectType ClickEvent event; } }, 'td', 'myData'); // $ExpectType JQuery $('table').one({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }, null, 'myData'); // $ExpectType JQuery $('table').one({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }, undefined, 'myData'); // $ExpectType JQuery $('table').one({ myEvent1: false, myEvent2(event) { // $ExpectType any this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType any this; // $ExpectType ClickEvent event; } }, 'td'); // $ExpectType JQuery $('table').one({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }, 3); // $ExpectType JQuery $('table').one({ myEvent1: false, myEvent2(event) { // $ExpectType HTMLElement this; // $ExpectType TriggeredEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; } }); } function trigger() { // $ExpectType JQuery $('p').trigger('myEvent', ['Custom', 'Event']); // $ExpectType JQuery $('p').trigger('myEvent', { myData: 'myData' }); // $ExpectType JQuery $('p').trigger('myEvent', 'Custom'); // $ExpectType JQuery $('p').trigger('myEvent', 3); // $ExpectType JQuery $('p').trigger('myEvent', true); // $ExpectType JQuery $('p').trigger($.Event('myEvent'), ['Custom', 'Event']); // $ExpectType JQuery $('p').trigger($.Event('myEvent'), { myData: 'myData' }); // $ExpectType JQuery $('p').trigger($.Event('myEvent'), 'Custom'); // $ExpectType JQuery $('p').trigger($.Event('myEvent'), 3); // $ExpectType JQuery $('p').trigger($.Event('myEvent'), true); } function triggerHandler() { // $ExpectType any $('p').triggerHandler('myEvent', ['Custom', 'Event']); // $ExpectType any $('p').triggerHandler('myEvent', { myData: 'myData' }); // $ExpectType any $('p').triggerHandler('myEvent', 'Custom'); // $ExpectType any $('p').triggerHandler('myEvent', 3); // $ExpectType any $('p').triggerHandler('myEvent', true); // $ExpectType any $('p').triggerHandler($.Event('myEvent'), ['Custom', 'Event']); // $ExpectType any $('p').triggerHandler($.Event('myEvent'), { myData: 'myData' }); // $ExpectType any $('p').triggerHandler($.Event('myEvent'), 'Custom'); // $ExpectType any $('p').triggerHandler($.Event('myEvent'), 3); // $ExpectType any $('p').triggerHandler($.Event('myEvent'), true); } function unbind() { function defaultData(this: HTMLElement, event: JQuery.TriggeredEvent) { } function customData(this: HTMLElement, event: JQuery.TriggeredEvent) { } function specificEventType(this: HTMLElement, event: JQuery.MouseDownEvent) { } // $ExpectType JQuery $('p').unbind('myEvent', defaultData); // $ExpectType JQuery $('p').unbind('myEvent', customData); // $ExpectType JQuery $('p').unbind('mousedown', specificEventType); // $ExpectType JQuery $('p').unbind('myEvent', false); // $ExpectType JQuery $('p').unbind('myEvent'); const ev: JQuery.TriggeredEvent = undefined!; // $ExpectType JQuery $('p').unbind(ev); // $ExpectType JQuery $('p').unbind(); } function undelegate() { function defaultData(this: HTMLElement, event: JQuery.TriggeredEvent) { } function customData(this: HTMLElement, event: JQuery.TriggeredEvent) { } function specificEventType(this: HTMLElement, event: JQuery.MouseDownEvent) { } // $ExpectType JQuery $('table').undelegate('td', 'click', defaultData); // $ExpectType JQuery $('table').undelegate('td', 'click', customData); // $ExpectType JQuery $('table').undelegate('td', 'mousedown', specificEventType); // $ExpectType JQuery $('table').undelegate('td', 'click', false); // $ExpectType JQuery $('table').undelegate('td', 'click'); // $ExpectType JQuery $('table').undelegate('td', { myEvent1: false, defaultData, customData }); // $ExpectType JQuery $('table').undelegate('.tt'); // $ExpectType JQuery $('table').undelegate(); } function blur() { // $ExpectType JQuery $('p').blur('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType BlurEvent event; }); // $ExpectType JQuery $('p').blur(function(event) { // $ExpectType HTMLElement this; // $ExpectType BlurEvent event; }); // $ExpectType JQuery $('p').blur(false); // $ExpectType JQuery $('p').blur(); } function change() { // $ExpectType JQuery $('p').change('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType ChangeEvent event; }); // $ExpectType JQuery $('p').change(function(event) { // $ExpectType HTMLElement this; // $ExpectType ChangeEvent event; }); // $ExpectType JQuery $('p').change(false); // $ExpectType JQuery $('p').change(); } function click() { // $ExpectType JQuery $('p').click('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; }); // $ExpectType JQuery $('p').click(function(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; }); // $ExpectType JQuery $('p').click(false); // $ExpectType JQuery $('p').click(); } function contextmenu() { // $ExpectType JQuery $('p').contextmenu('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType ContextMenuEvent event; }); // $ExpectType JQuery $('p').contextmenu(function(event) { // $ExpectType HTMLElement this; // $ExpectType ContextMenuEvent event; }); // $ExpectType JQuery $('p').contextmenu(false); // $ExpectType JQuery $('p').contextmenu(); } function dblclick() { // $ExpectType JQuery $('p').dblclick('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType DoubleClickEvent event; }); // $ExpectType JQuery $('p').dblclick(function(event) { // $ExpectType HTMLElement this; // $ExpectType DoubleClickEvent event; }); // $ExpectType JQuery $('p').dblclick(false); // $ExpectType JQuery $('p').dblclick(); } function focus() { // $ExpectType JQuery $('p').focus('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType FocusEvent event; }); // $ExpectType JQuery $('p').focus(function(event) { // $ExpectType HTMLElement this; // $ExpectType FocusEvent event; }); // $ExpectType JQuery $('p').focus(false); // $ExpectType JQuery $('p').focus(); } function focusin() { // $ExpectType JQuery $('p').focusin('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType FocusInEvent event; }); // $ExpectType JQuery $('p').focusin(function(event) { // $ExpectType HTMLElement this; // $ExpectType FocusInEvent event; }); // $ExpectType JQuery $('p').focusin(false); // $ExpectType JQuery $('p').focusin(); } function focusout() { // $ExpectType JQuery $('p').focusout('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType FocusOutEvent event; }); // $ExpectType JQuery $('p').focusout(function(event) { // $ExpectType HTMLElement this; // $ExpectType FocusOutEvent event; }); // $ExpectType JQuery $('p').focusout(false); // $ExpectType JQuery $('p').focusout(); } function keydown() { // $ExpectType JQuery $('p').keydown('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType KeyDownEvent event; }); // $ExpectType JQuery $('p').keydown(function(event) { // $ExpectType HTMLElement this; // $ExpectType KeyDownEvent event; }); // $ExpectType JQuery $('p').keydown(false); // $ExpectType JQuery $('p').keydown(); } function keypress() { // $ExpectType JQuery $('p').keypress('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType KeyPressEvent event; }); // $ExpectType JQuery $('p').keypress(function(event) { // $ExpectType HTMLElement this; // $ExpectType KeyPressEvent event; }); // $ExpectType JQuery $('p').keypress(false); // $ExpectType JQuery $('p').keypress(); } function keyup() { // $ExpectType JQuery $('p').keyup('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType KeyUpEvent event; }); // $ExpectType JQuery $('p').keyup(function(event) { // $ExpectType HTMLElement this; // $ExpectType KeyUpEvent event; }); // $ExpectType JQuery $('p').keyup(false); // $ExpectType JQuery $('p').keyup(); } function mousedown() { // $ExpectType JQuery $('p').mousedown('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseDownEvent event; }); // $ExpectType JQuery $('p').mousedown(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseDownEvent event; }); // $ExpectType JQuery $('p').mousedown(false); // $ExpectType JQuery $('p').mousedown(); } function mouseenter() { // $ExpectType JQuery $('p').mouseenter('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseEnterEvent event; }); // $ExpectType JQuery $('p').mouseenter(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseEnterEvent event; }); // $ExpectType JQuery $('p').mouseenter(false); // $ExpectType JQuery $('p').mouseenter(); } function mouseleave() { // $ExpectType JQuery $('p').mouseleave('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseLeaveEvent event; }); // $ExpectType JQuery $('p').mouseleave(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseLeaveEvent event; }); // $ExpectType JQuery $('p').mouseleave(false); // $ExpectType JQuery $('p').mouseleave(); } function mousemove() { // $ExpectType JQuery $('p').mousemove('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseMoveEvent event; }); // $ExpectType JQuery $('p').mousemove(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseMoveEvent event; }); // $ExpectType JQuery $('p').mousemove(false); // $ExpectType JQuery $('p').mousemove(); } function mouseout() { // $ExpectType JQuery $('p').mouseout('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseOutEvent event; }); // $ExpectType JQuery $('p').mouseout(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseOutEvent event; }); // $ExpectType JQuery $('p').mouseout(false); // $ExpectType JQuery $('p').mouseout(); } function mouseover() { // $ExpectType JQuery $('p').mouseover('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseOverEvent event; }); // $ExpectType JQuery $('p').mouseover(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseOverEvent event; }); // $ExpectType JQuery $('p').mouseover(false); // $ExpectType JQuery $('p').mouseover(); } function mouseup() { // $ExpectType JQuery $('p').mouseup('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseUpEvent event; }); // $ExpectType JQuery $('p').mouseup(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseUpEvent event; }); // $ExpectType JQuery $('p').mouseup(false); // $ExpectType JQuery $('p').mouseup(); } function resize() { // $ExpectType JQuery $('p').resize('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType ResizeEvent event; }); // $ExpectType JQuery $('p').resize(function(event) { // $ExpectType HTMLElement this; // $ExpectType ResizeEvent event; }); // $ExpectType JQuery $('p').resize(false); // $ExpectType JQuery $('p').resize(); } function scroll() { // $ExpectType JQuery $('p').scroll('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType ScrollEvent event; }); // $ExpectType JQuery $('p').scroll(function(event) { // $ExpectType HTMLElement this; // $ExpectType ScrollEvent event; }); // $ExpectType JQuery $('p').scroll(false); // $ExpectType JQuery $('p').scroll(); } function select() { // $ExpectType JQuery $('p').select('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType SelectEvent event; }); // $ExpectType JQuery $('p').select(function(event) { // $ExpectType HTMLElement this; // $ExpectType SelectEvent event; }); // $ExpectType JQuery $('p').select(false); // $ExpectType JQuery $('p').select(); } function submit() { // $ExpectType JQuery $('p').submit('myData', function(event) { // $ExpectType HTMLElement this; // $ExpectType SubmitEvent event; }); // $ExpectType JQuery $('p').submit(function(event) { // $ExpectType HTMLElement this; // $ExpectType SubmitEvent event; }); // $ExpectType JQuery $('p').submit(false); // $ExpectType JQuery $('p').submit(); } function hover() { // $ExpectType JQuery $('p').hover(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseEnterEvent event; }, function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseLeaveEvent event; }); // $ExpectType JQuery $('p').hover(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseEnterEvent event; }, false); // $ExpectType JQuery $('p').hover(false, function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseLeaveEvent event; }); // $ExpectType JQuery $('p').hover(false, false); // $ExpectType JQuery $('p').hover(function(event) { // $ExpectType HTMLElement this; // $ExpectType MouseEnterEvent | MouseLeaveEvent event; switch (event.type) { case 'mouseover': // $ExpectType MouseEnterEvent event; break; case 'mouseout': // $ExpectType MouseLeaveEvent event; break; default: // $ExpectType never event; break; } }); // $ExpectType JQuery $('p').hover(false); } function ready() { // $ExpectType JQuery $('p').ready(($) => { // $ExpectType JQueryStatic $; }); } } function manipulation() { function after() { // $ExpectType JQuery $('p').after('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').after(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return '

'; }); // $ExpectType JQuery $('p').after(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Element(); }); // $ExpectType JQuery $('p').after(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Text(); }); // $ExpectType JQuery $('p').after(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return $('p').contents(); }); // $ExpectType JQuery $('p').after(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return [new Element(), new Text(), $('p').contents()]; }); } function append() { // $ExpectType JQuery $('p').append('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').append(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return '

'; }); // $ExpectType JQuery $('p').append(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Element(); }); // $ExpectType JQuery $('p').append(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Text(); }); // $ExpectType JQuery $('p').append(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return $('p').contents(); }); // $ExpectType JQuery $('p').append($.parseHTML('myTextNode ')); // $ExpectType JQuery $('p').append(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return [new Element(), new Text(), $('p').contents()]; }); } function before() { // $ExpectType JQuery $('p').before('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').before(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return '

'; }); // $ExpectType JQuery $('p').before(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Element(); }); // $ExpectType JQuery $('p').before(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Text(); }); // $ExpectType JQuery $('p').before(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return $('p').contents(); }); // $ExpectType JQuery $('p').before(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return [new Element(), new Text(), $('p').contents()]; }); } function prepend() { // $ExpectType JQuery $('p').prepend('

', new Element(), new Text(), $('p').contents(), [new Element(), new Text()], [new Element(), $('p').contents()], document.createDocumentFragment()); // $ExpectType JQuery $('p').prepend(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return '

'; }); // $ExpectType JQuery $('p').prepend(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Element(); }); // $ExpectType JQuery $('p').prepend(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return new Text(); }); // $ExpectType JQuery $('p').prepend(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return $('p').contents(); }); // $ExpectType JQuery $('p').prepend(function(index, html) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string html; return [new Element(), new Text(), $('p').contents()]; }); } function appendTo() { // $ExpectType JQuery $('span').appendTo('p'); // $ExpectType JQuery $('span').appendTo('

'); // $ExpectType JQuery $('span').appendTo(new HTMLElement()); // $ExpectType JQuery $('span').appendTo([new HTMLElement()]); // $ExpectType JQuery $('span').appendTo($('p')); // $ExpectType JQuery $('span').appendTo(document.createDocumentFragment()); } function insertAfter() { // $ExpectType JQuery $('span').insertAfter('p'); // $ExpectType JQuery $('span').insertAfter('

'); // $ExpectType JQuery $('span').insertAfter(new HTMLElement()); // $ExpectType JQuery $('span').insertAfter([new HTMLElement()]); // $ExpectType JQuery $('span').insertAfter($('p')); // $ExpectType JQuery $('span').insertAfter(new Text('hello!')); // $ExpectType JQuery $('span').insertAfter($(new Text('hello!'))); } function insertBefore() { // $ExpectType JQuery $('span').insertBefore('p'); // $ExpectType JQuery $('span').insertBefore('

'); // $ExpectType JQuery $('span').insertBefore(new HTMLElement()); // $ExpectType JQuery $('span').insertBefore([new HTMLElement()]); // $ExpectType JQuery $('span').insertBefore($('p')); // $ExpectType JQuery $('span').insertBefore(new Text('hello!')); // $ExpectType JQuery $('span').insertBefore($(new Text('hello!'))); } function prependTo() { // $ExpectType JQuery $('span').prependTo('p'); // $ExpectType JQuery $('span').prependTo('

'); // $ExpectType JQuery $('span').prependTo(new HTMLElement()); // $ExpectType JQuery $('span').prependTo([new HTMLElement()]); // $ExpectType JQuery $('span').prependTo($('p')); // $ExpectType JQuery $('span').prependTo(document.createDocumentFragment()); } function clone() { // $ExpectType JQuery $('p').clone(true, true); // $ExpectType JQuery $('p').clone(true); // $ExpectType JQuery $('p').clone(); } function detach() { // $ExpectType JQuery $('p').detach('span'); // $ExpectType JQuery $('p').detach(); } function empty() { // $ExpectType JQuery $('p').empty(); } function remove() { // $ExpectType JQuery $('p').remove('span'); // $ExpectType JQuery $('p').remove(); } function replaceAll() { // $ExpectType JQuery $('p').replaceAll('span'); // $ExpectType JQuery $('p').replaceAll($('span')); // $ExpectType JQuery $('p').replaceAll(new HTMLElement()); // $ExpectType JQuery $('p').replaceAll([new HTMLElement()]); } function replaceWith() { // $ExpectType JQuery $('p').replaceWith(''); // $ExpectType JQuery $('p').replaceWith($('span')); // $ExpectType JQuery $('p').replaceWith(new HTMLElement()); // $ExpectType JQuery $('p').replaceWith([new HTMLElement()]); // $ExpectType JQuery $('p').replaceWith(document.createTextNode('bar')); // $ExpectType JQuery $('p').replaceWith(document.createComment('bar')); // $ExpectType JQuery $('p').replaceWith(function(index, oldhtml) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string oldhtml; return undefined! as JQuery.htmlString | JQuery | JQuery.TypeOrArray | JQuery.Node; }); } function unwrap() { // $ExpectType JQuery $('p').unwrap('span'); // $ExpectType JQuery $('p').unwrap(); } function wrap() { // $ExpectType JQuery $('p').wrap('span'); // $ExpectType JQuery $('p').wrap(''); // $ExpectType JQuery $('p').wrap(new HTMLElement()); // $ExpectType JQuery $('p').wrap($('span')); // $ExpectType JQuery $('p').wrap(function(index) { // $ExpectType HTMLElement this; // $ExpectType number index; return ''; }); // $ExpectType JQuery $('p').wrap(function(index) { // $ExpectType HTMLElement this; // $ExpectType number index; return $('span'); }); } function wrapAll() { // $ExpectType JQuery $('p').wrapAll('span'); // $ExpectType JQuery $('p').wrapAll(''); // $ExpectType JQuery $('p').wrapAll(new HTMLElement()); // $ExpectType JQuery $('p').wrapAll($('span')); // $ExpectType JQuery $('p').wrapAll(function() { // $ExpectType HTMLElement this; return ''; }); // $ExpectType JQuery $('p').wrapAll(function() { // $ExpectType HTMLElement this; return $('span'); }); } function wrapInner() { // $ExpectType JQuery $('p').wrapInner('span'); // $ExpectType JQuery $('p').wrapInner(''); // $ExpectType JQuery $('p').wrapInner(new HTMLElement()); // $ExpectType JQuery $('p').wrapInner($('span')); // $ExpectType JQuery $('p').wrapInner(function(index) { // $ExpectType HTMLElement this; // $ExpectType number index; return ''; }); // $ExpectType JQuery $('p').wrapInner(function(index) { // $ExpectType HTMLElement this; // $ExpectType number index; return $('span'); }); // $ExpectType JQuery $('p').wrapInner(function(index) { // $ExpectType HTMLElement this; // $ExpectType number index; return new HTMLElement(); }); } function html() { // $ExpectType JQuery $('p').html(''); // $ExpectType JQuery $('p').html(document.createTextNode('bar')); // $ExpectType JQuery $('p').html(document.createComment('bar')); // $ExpectType JQuery $('p').html(function(index, oldhtml) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string oldhtml; switch (index) { case 0: return document.createTextNode('bar'); case 1: return document.createComment('bar'); default: return oldhtml; } }); // $ExpectType string $('p').html(); } function text() { // $ExpectType JQuery $('p').text('myText'); // $ExpectType JQuery $('p').text(4); // $ExpectType JQuery $('p').text(true); // $ExpectType JQuery $('p').text(function(index, text) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string text; return 'myText'; }); // $ExpectType JQuery $('p').text(function(index, text) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string text; return 3; }); // $ExpectType JQuery $('p').text(function(index, text) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string text; return false; }); // $ExpectType string $('p').text(); } function val() { // $ExpectType JQuery $('p').val('myVal'); // $ExpectType JQuery $('p').val(5); // $ExpectType JQuery $('p').val(['myVal']); // $ExpectType JQuery $('p').val(function(index, value) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType string value; return 'myVal'; }); // $ExpectType string | number | string[] | undefined $('p').val(); } } function traversing() { function add() { // $ExpectType JQuery $('p').add('span', new HTMLElement()); // $ExpectType JQuery $('p').add('span'); // $ExpectType JQuery $('p').add(new HTMLElement()); // $ExpectType JQuery $('p').add([new HTMLElement()]); // $ExpectType JQuery $('p').add(''); // $ExpectType JQuery $('p').add($('span')); // $ExpectType JQuery $('p').add(document.createTextNode('bar')); // $ExpectType JQuery $('p').add(document.createComment('bar')); } function closest() { // $ExpectType JQuery $('p').closest('span', new HTMLElement()); // $ExpectType JQuery $('p').closest('span'); // $ExpectType JQuery $('p').closest(new HTMLElement()); // $ExpectType JQuery $('p').closest($('span')); } function find() { // $ExpectType JQuery $('p').find('span'); // $ExpectType JQuery $('p').find(new HTMLElement()); // $ExpectType JQuery $('p').find($('span')); } function addBack() { // $ExpectType JQuery $('p').addBack('span'); // $ExpectType JQuery $('p').addBack(); } function children() { // $ExpectType JQuery $('p').children('span'); // $ExpectType JQuery $('p').children(); } function siblings() { // $ExpectType JQuery $('p').siblings('span'); // $ExpectType JQuery $('p').siblings(); } function contents() { // TODO: Flaky test due to type ordering. // // $ExpectType JQuery // $('p').contents(); } function end() { // $ExpectType JQuery $('p').end(); } function first() { // $ExpectType JQuery $('p').first(); } function last() { // $ExpectType JQuery $('p').last(); } function offsetParent() { // $ExpectType JQuery $('p').offsetParent(); } function filter() { // $ExpectType JQuery $('p').filter('span'); // $ExpectType JQuery $('p').filter(new HTMLElement()); // $ExpectType JQuery $('p').filter([new HTMLElement()]); // $ExpectType JQuery $('p').filter($('span')); // $ExpectType JQuery $('p').filter(function(index, element) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement element; return false; }); } function not() { // $ExpectType JQuery $('p').not('span'); // $ExpectType JQuery $('p').not(new HTMLElement()); // $ExpectType JQuery $('p').not([new HTMLElement()]); // $ExpectType JQuery $('p').not($('span')); // $ExpectType JQuery $('p').not(function(index, element) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement element; return false; }); } function is() { // $ExpectType boolean $('p').is('span'); // $ExpectType boolean $('p').is(new HTMLElement()); // $ExpectType boolean $('p').is([new HTMLElement()]); // $ExpectType boolean $('p').is($('span')); // $ExpectType boolean $('p').is(function(index, element) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement element; return false; }); } function next() { // $ExpectType JQuery $('p').next('span'); // $ExpectType JQuery $('p').next(); } function nextAll() { // $ExpectType JQuery $('p').nextAll('span'); // $ExpectType JQuery $('p').nextAll(); } function nextUntil() { // $ExpectType JQuery $('p').nextUntil('span', 'span'); // $ExpectType JQuery $('p').nextUntil(new HTMLElement(), 'span'); // $ExpectType JQuery $('p').nextUntil($('span'), 'span'); // $ExpectType JQuery $('p').nextUntil('span'); // $ExpectType JQuery $('p').nextUntil(new HTMLElement()); // $ExpectType JQuery $('p').nextUntil($('span')); // $ExpectType JQuery $('p').nextUntil(); } function prev() { // $ExpectType JQuery $('p').prev('span'); // $ExpectType JQuery $('p').prev(); } function prevAll() { // $ExpectType JQuery $('p').prevAll('span'); // $ExpectType JQuery $('p').prevAll(); } function prevUntil() { // $ExpectType JQuery $('p').prevUntil('span', 'span'); // $ExpectType JQuery $('p').prevUntil(new HTMLElement(), 'span'); // $ExpectType JQuery $('p').prevUntil($('span'), 'span'); // $ExpectType JQuery $('p').prevUntil('span'); // $ExpectType JQuery $('p').prevUntil(new HTMLElement()); // $ExpectType JQuery $('p').prevUntil($('span')); // $ExpectType JQuery $('p').prevUntil(); } function parent() { // $ExpectType JQuery $('p').parent('span'); // $ExpectType JQuery $('p').parent(); } function parents() { // $ExpectType JQuery $('p').parents('span'); // $ExpectType JQuery $('p').parents(); } function parentsUntil() { // $ExpectType JQuery $('p').parentsUntil('span', 'span'); // $ExpectType JQuery $('p').parentsUntil(new HTMLElement(), 'span'); // $ExpectType JQuery $('p').parentsUntil($('span'), 'span'); // $ExpectType JQuery $('p').parentsUntil('span'); // $ExpectType JQuery $('p').parentsUntil(new HTMLElement()); // $ExpectType JQuery $('p').parentsUntil($('span')); // $ExpectType JQuery $('p').parentsUntil(); } function eq() { // $ExpectType JQuery $('p').eq(0); } function has() { // $ExpectType JQuery $('p').has('span'); // $ExpectType JQuery $('p').has(new HTMLElement()); } function map() { // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement domElement; return 'myVal'; }); // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement domElement; return ['myVal1', 'myVal2']; }); // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement domElement; return ['myVal1', 'myVal2', null]; }); // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement domElement; return ['myVal1', 'myVal2', undefined]; }); // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement domElement; let value: string; if (index % 2 === 0) { return null; } value = 'myVal'; return value; }); // $ExpectType JQuery $('p').map(function(index, domElement) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement domElement; let value: string; if (index % 2 === 0) { return undefined; } value = 'myVal'; return value; }); // // $ExpectType JQuery // $('p').map(function(index, domElement) { // // $ExpectType HTMLElement // this; // // $ExpectType number // index; // // $ExpectType HTMLElement // domElement; // // return null; // }); // // $ExpectType JQuery // $('p').map(function(index, domElement) { // // $ExpectType HTMLElement // this; // // $ExpectType number // index; // // $ExpectType HTMLElement // domElement; // // return undefined; // }); } function slice() { // $ExpectType JQuery $('p').slice(0, 10); // $ExpectType JQuery $('p').slice(0); } function pushStack() { // $ExpectType JQuery $('p').pushStack([new HTMLElement()], 'name', ['arg']); // $ExpectType JQuery $('p').pushStack([new HTMLElement()]); } } function misc() { function serialize() { // $ExpectType string $('p').serialize(); } function serializeArray() { // $ExpectType NameValuePair[] $('p').serializeArray(); } function each() { // $ExpectType JQuery $('p').each(function(index, element) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement element; }); // $ExpectType JQuery $('p').each(function(index, element) { // $ExpectType HTMLElement this; // $ExpectType number index; // $ExpectType HTMLElement element; return false; }); } function extend() { // $ExpectType JQuery $.fn.extend({ myPlugin: {} }); } function get() { // $ExpectType HTMLElement $('p').get(0); // $ExpectType HTMLElement[] $('p').get(); } function index() { // $ExpectType number $('p').index('span'); // $ExpectType number $('p').index(new HTMLElement()); // $ExpectType number $('p').index($('span')); // $ExpectType number $('p').index(); } function toArray() { // $ExpectType HTMLElement[] $('p').toArray(); } } } function JQuery_Selectors() { function pseudos_colon() { // $ExpectType PseudoFunctions $.expr[':']; } function filter() { // $ExpectType FilterFunctions $.expr.filter; } function stackoverflow_50727144() { $.extend($.expr[":"], { containsCaseInsensitive: (elem: any, i: number, match: any, array: any) => (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0 }); } } function JQuery_AjaxSettings() { $.ajax({ accepts: { mycustomtype: 'application/x-some-custom-type' }, async: true, beforeSend(jqXHR, settings) { // $ExpectType any this; // $ExpectType jqXHR jqXHR; // $ExpectType AjaxSettings settings; }, cache: false, complete(jqXHR, textStatus) { // $ExpectType any this; // $ExpectType jqXHR jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; }, contents: { mycustomtype: /mycustomtype/ }, contentType: 'application/x-some-custom-type', converters: { 'text mycustomtype': true, 'mycustomtype json': (result) => { // $ExpectType any result; return result; } }, crossDomain: false, data: { myData: 'myData' }, dataFilter(data, type) { // $ExpectType string data; // $ExpectType string type; return 'filtered'; }, dataType: 'mycustomtype', error(jqXHR, textStatus, errorThrown) { // $ExpectType any this; // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }, global: true, headers: { 'X-Requested-With': 'XMLHttpRequest' }, ifModified: false, isLocal: true, jsonp: 'callback', jsonpCallback: 'callback', method: 'PUT', mimeType: 'mimeType', password: 'hunter2', processData: false, scriptCharset: 'scriptCharset', statusCode: { 200(data, textStatus, jqXHR) { // $ExpectType any this; // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, 404(jqXHR, textStatus, errorThrown) { // $ExpectType any this; // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; } }, success(data, textStatus, jqXHR) { // $ExpectType any this; // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, timeout: 10, traditional: true, username: 'username', xhr() { return new XMLHttpRequest(); }, xhrFields: { withCredentials: true } }); $.ajax({ beforeSend(jqXHR, settings) { // $ExpectType any this; // $ExpectType jqXHR jqXHR; // $ExpectType AjaxSettings settings; return false; }, complete: [function(jqXHR, textStatus) { // $ExpectType any this; // $ExpectType jqXHR jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; }], contentType: false, data: 'myData', error: [function(jqXHR, textStatus, errorThrown) { // $ExpectType any this; // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }], jsonp: false, jsonpCallback() { // $ExpectType any this; return 'callback'; }, success: [function(data, textStatus, jqXHR) { // $ExpectType any this; // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }] }); } function JQuery_jqXHR() { const p: JQuery.jqXHR = {} as any; function always() { // $ExpectType jqXHR $.ajax('/echo/json').always((data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }, [(data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }], (data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }); // $ExpectType jqXHR $.ajax('/echo/json').always((data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }, [(data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }]); // $ExpectType jqXHR $.ajax('/echo/json').always([(data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }], (data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }); // $ExpectType jqXHR $.ajax('/echo/json').always((data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }); // $ExpectType jqXHR $.ajax('/echo/json').always([(data_jqXHR, textStatus, jqXHR_errorThrown) => { // $ExpectType any data_jqXHR; // // $ExpectType "success" | "notmodified" | "nocontent" | "error" | "timeout" | "abort" | "parsererror" // textStatus; // $ExpectType string | jqXHR jqXHR_errorThrown; }]); } function done() { // $ExpectType jqXHR $.ajax('/echo/json').done((data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, [(data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }], (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType jqXHR $.ajax('/echo/json').done((data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }, [(data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }]); // $ExpectType jqXHR $.ajax('/echo/json').done([(data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }], (data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType jqXHR $.ajax('/echo/json').done((data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }); // $ExpectType jqXHR $.ajax('/echo/json').done([(data, textStatus, jqXHR) => { // $ExpectType any data; // $ExpectType SuccessTextStatus textStatus; // $ExpectType jqXHR jqXHR; }]); } function fail() { // $ExpectType jqXHR $.ajax('/echo/json').fail((jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }, [(jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }], (jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }); // $ExpectType jqXHR $.ajax('/echo/json').fail((jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }, [(jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }]); // $ExpectType jqXHR $.ajax('/echo/json').fail([(jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }], (jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }); // $ExpectType jqXHR $.ajax('/echo/json').fail((jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }); // $ExpectType jqXHR $.ajax('/echo/json').fail([(jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }]); } function _catch() { { const a = $.ajax('/echo').catch((jqXHR, textStatus, errorThrown) => { // $ExpectType jqXHR jqXHR; // $ExpectType ErrorTextStatus textStatus; // $ExpectType string errorThrown; }); // $ExpectType PromiseBase a; const b: JQuery.Promise3 = a; } } function compatibleWithPromise(): Promise { return p; } function compatibleWithJQueryPromise(): JQuery.Promise { return p; } } function JQuery_CallbacksStatic() { // $ExpectType Callbacks $.Callbacks('once'); // $ExpectType Callbacks $.Callbacks(); } function JQuery_Callbacks() { function add() { const callbacks = $.Callbacks(); // $ExpectType Callbacks callbacks.add(() => { }, [() => { }], () => { }); // $ExpectType Callbacks callbacks.add(() => { }, [() => { }]); // $ExpectType Callbacks callbacks.add(() => { }, () => { }); // $ExpectType Callbacks callbacks.add(() => { }); // $ExpectType Callbacks callbacks.add([() => { }]); } function disable() { // $ExpectType Callbacks $.Callbacks().disable(); } function disabled() { // $ExpectType boolean $.Callbacks().disabled(); } function empty() { // $ExpectType Callbacks $.Callbacks().empty(); } function fire() { // $ExpectType Callbacks $.Callbacks().fire(1); // $ExpectType Callbacks $.Callbacks().fire(); } function fired() { // $ExpectType boolean $.Callbacks().fired(); } function fireWith() { // $ExpectType Callbacks $.Callbacks().fireWith(window, [1]); // $ExpectType Callbacks $.Callbacks().fireWith(window); } function has() { // $ExpectType boolean $.Callbacks().has(() => { }); // $ExpectType boolean $.Callbacks().has(); } function lock() { // $ExpectType Callbacks $.Callbacks().lock(); } function locked() { // $ExpectType boolean $.Callbacks().locked(); } function remove() { // $ExpectType Callbacks $.Callbacks().remove(() => { }, () => { }); } } function JQuery_CSSHooks() { $.cssHooks.borderRadius = { get(elem, computed, extra) { // $ExpectedType HTMLElement elem; // $ExpectedType any computed; // $ExpectedType any extra; }, set(elem, value) { // $ExpectedType HTMLElement elem; // $ExpectedType any value; } }; $.cssHooks.borderRadius = { get(elem, computed, extra) { // $ExpectedType HTMLElement elem; // $ExpectedType any computed; // $ExpectedType any extra; } }; $.cssHooks.borderRadius = { set(elem, value) { // $ExpectedType HTMLElement elem; // $ExpectedType any value; } }; // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. // $ExpectError $.cssHooks.borderRadius = function get(elem: HTMLElement, computed: any, extra: any) { return 1; }; } function JQuery_Promise3() { interface J1 { kind: 'J1'; } interface J2 { kind: 'J2'; } interface J3 { kind: 'J3'; } interface J4 { kind: 'J4'; } interface J5 { kind: 'J5'; } interface J6 { kind: 'J6'; } interface J7 { kind: 'J7'; } interface J8 { kind: 'J8'; } interface J9 { kind: 'J9'; } const p: JQuery.Promise3 = {} as any; const p1: JQuery.Promise3 = {} as any; const p2: JQuery.Promise3 = {} as any; const p3: JQuery.Promise3 = {} as any; const t1: JQuery.Thenable = {} as any; const t2: JQuery.Thenable = {} as any; const t3: JQuery.Thenable = {} as any; function then() { p.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean c; // $ExpectType never }); p.then(null, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean c; // $ExpectType never }); p.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, null, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean c; // $ExpectType never }); p.then(null, null, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean c; // $ExpectType never }); p.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }, null); p.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }); p.then(null, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }, null); p.then(null, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }); p.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, null, null); p.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, null); p.then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }); function doneFilter() { p.then(() => { return 1; }).then((a) => { a; // $ExpectType number }); p.then(() => { return $.ready; }).then((a) => { a; // $ExpectType JQueryStatic }); p.then(() => { return p; }).then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean c; // $ExpectType never }); } function failFilter() { p.then(null, () => { return 1; }).then((a) => { a; // $ExpectType number }); p.then(null, () => { return $.ready; }).then((a) => { a; // $ExpectType JQueryStatic }); p.then(null, () => { return p; }).then((a, b, c) => { a; // $ExpectType string b; // $ExpectType JQuery c; // $ExpectType any }, (a, b, c) => { a; // $ExpectType Error b; // $ExpectType string c; // $ExpectType Element }, (a, b, c) => { a; // $ExpectType number b; // $ExpectType boolean c; // $ExpectType never }); } function doneFilter_failFilter() { // (value, value) { const q = p.then(() => { return 1; }, () => { return 1; }); q.then((a) => { a; // $ExpectType number }, (a) => { a; // $ExpectType never }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never c; // $ExpectType never }); } // (Thenable, Thenable) { const q = p.then(() => { return t1; }, () => { return t2; }); q.then((a) => { a; // $ExpectType J1 | J2 }, (a) => { a; // $ExpectType never }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never c; // $ExpectType never }); } // (Promise3, Promise3) { const q = p.then(() => { return p1; }, () => { return p2; }); q.then((a, b, c) => { a; // $ExpectType J1 | J2 b; // $ExpectType J4 | J5 c; // $ExpectType J7 | J8 }, (a, b, c) => { a; // $ExpectType J2 | J3 b; // $ExpectType J5 | J6 c; // $ExpectType J8 | J9 }, (a, b, c) => { a; // $ExpectType J3 | J4 b; // $ExpectType J6 | J7 c; // $ExpectType J1 | J9 }); } // (value, Thenable) { const q = p.then(() => { return 1; }, () => { return t1; }); q.then((a) => { a; // $ExpectType number | J1 }, (a) => { a; // never }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never c; // $ExpectType never }); } // (Thenable, value) { const q = p.then(() => { return t1; }, () => { return 1; }); q.then((a) => { a; // $ExpectType number | J1 }, (a) => { a; // never }, (a, b, c) => { a; // $ExpectType never b; // $ExpectType never c; // $ExpectType never }); } // (value, Promise3) { const q = p.then(() => { return 1; }, () => { return p1; }); q.then((a, b, c) => { a; // $ExpectType number | J1 b; // $ExpectType J4 c; // $ExpectType J7 }, (a, b, c) => { a; // $ExpectType J2 b; // $ExpectType J5 c; // $ExpectType J8 }, (a, b, c) => { a; // $ExpectType J3 b; // $ExpectType J6 c; // $ExpectType J9 }); } // (Promise3, value) { const q = p.then(() => { return p1; }, () => { return 1; }); q.then((a, b, c) => { a; // $ExpectType number | J1 b; // $ExpectType J4 c; // $ExpectType J7 }, (a, b, c) => { a; // $ExpectType J2 b; // $ExpectType J5 c; // $ExpectType J8 }, (a, b, c) => { a; // $ExpectType J3 b; // $ExpectType J6 c; // $ExpectType J9 }); } // (Thenable, Promise3) { const q = p.then(() => { return t1; }, () => { return p2; }); q.then((a, b, c) => { a; // $ExpectType J1 | J2 b; // $ExpectType J5 c; // $ExpectType J8 }, (a, b, c) => { a; // $ExpectType J3 b; // $ExpectType J6 c; // $ExpectType J9 }, (a, b, c) => { a; // $ExpectType J4 b; // $ExpectType J7 c; // $ExpectType J1 }); } // (Promise3, Thenable) { const q = p.then(() => { return p1; }, () => { return t2; }); q.then((a, b, c) => { a; // $ExpectType J1 | J2 b; // $ExpectType J4 c; // $ExpectType J7 }, (a, b, c) => { a; // $ExpectType J2 b; // $ExpectType J5 c; // $ExpectType J8 }, (a, b, c) => { a; // $ExpectType J3 b; // $ExpectType J6 c; // $ExpectType J9 }); } } } function _catch() { { const a = $.ajax('/echo/json').catch(() => { return 1; }); // $ExpectType PromiseBase a; const b: JQuery.Promise3 = a; } { const a = $.ajax('/echo/json').catch(() => { return t1; }); // $ExpectType PromiseBase a; const b: JQuery.Promise3 = a; } { const a = $.ajax('/echo/json').catch(() => { return $.ajax('/echo/json'); }); // $ExpectType PromiseBase, never, SuccessTextStatus, ErrorTextStatus, never, jqXHR, string, never, never, never, never> a; const b: JQuery.Promise3 = a; } // $ExpectType PromiseBase $.ajax('/echo/json').catch(undefined); // $ExpectType PromiseBase $.ajax('/echo/json').catch(null); // $ExpectType PromiseBase $.ajax('/echo/json').catch(); } // As argument to PromiseLike parameter { Promise.resolve(p).then(a => { a; // $ExpectType string }); } async function testAsync(p: JQuery.Promise3): Promise { // tslint:disable-next-line:await-promise const s: string = await p; return s; } function compatibleWithPromise(): Promise { return p; } function compatibleWithJQueryPromise(): JQuery.Promise { return p; } } function JQuery_Promise2(p: JQuery.Promise2) { function then() { p.then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }, (a, b) => { a; // $ExpectType number b; // $ExpectType boolean }); p.then(null, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }, (a, b) => { a; // $ExpectType number b; // $ExpectType boolean }); p.then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, null, (a, b) => { a; // $ExpectType number b; // $ExpectType boolean }); p.then(null, null, (a, b) => { a; // $ExpectType number b; // $ExpectType boolean }); p.then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }, null); p.then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }); p.then(null, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }, null); p.then(null, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }); p.then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, null, null); p.then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, null); p.then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }); function doneFilter() { p.then(() => { return 1; }).then((a) => { a; // $ExpectType number }); p.then(() => { return $.ready; }).then((a) => { a; // $ExpectType JQueryStatic }); p.then(() => { return p; }).then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }, (a, b) => { a; // $ExpectType number b; // $ExpectType boolean }); } function failFilter() { p.then(null, () => { return 1; }).then((a) => { a; // $ExpectType number }); p.then(null, () => { return $.ready; }).then((a) => { a; // $ExpectType JQueryStatic }); p.then(null, () => { return p; }).then((a, b) => { a; // $ExpectType string b; // $ExpectType JQuery }, (a, b) => { a; // $ExpectType Error b; // $ExpectType string }, (a, b) => { a; // $ExpectType number b; // $ExpectType boolean }); } } async function testAsync(p: JQuery.Promise2): Promise { // tslint:disable-next-line:await-promise const s: string = await p; return s; } function compatibleWithPromise(): Promise { return p; } function compatibleWithJQueryPromise(): JQuery.Promise { return p; } } function JQuery_Promise(p: JQuery.Promise) { function then() { p.then((a) => { a; // $ExpectType string }, (a) => { a; // $ExpectType Error }, (a) => { a; // $ExpectType number }); p.then(null, (a) => { a; // $ExpectType Error }, (a) => { a; // $ExpectType number }); p.then((a) => { a; // $ExpectType string }, null, (a) => { a; // $ExpectType number }); p.then(null, null, (a) => { a; // $ExpectType number }); p.then((a) => { a; // $ExpectType string }, (a) => { a; // $ExpectType Error }, null); p.then((a) => { a; // $ExpectType string }, (a) => { a; // $ExpectType Error }); p.then(null, (a) => { a; // $ExpectType Error }, null); p.then(null, (a) => { a; // $ExpectType Error }); p.then((a) => { a; // $ExpectType string }, null, null); p.then((a) => { a; // $ExpectType string }, null); p.then((a) => { a; // $ExpectType string }); function doneFilter() { p.then(() => { return 1; }).then((a) => { a; // $ExpectType number }); p.then(() => { return $.ready; }).then((a) => { a; // $ExpectType JQueryStatic }); p.then(() => { return p; }).then((a) => { a; // $ExpectType string }, (a) => { a; // $ExpectType Error }, (a) => { a; // $ExpectType number }); } function failFilter() { p.then(null, () => { return 1; }).then((a) => { a; // $ExpectType number }); p.then(null, () => { return $.ready; }).then((a) => { a; // $ExpectType JQueryStatic }); p.then(null, () => { return p; }).then((a) => { a; // $ExpectType string }, (a) => { a; // $ExpectType Error }, (a) => { a; // $ExpectType number }); } } async function testAsync(p: JQuery.Promise): Promise { const s: string = await p; return s; } function compatibleWithPromise(): Promise { return p; } } function JQuery_DeferredStatic() { function exceptionHook() { $.Deferred.exceptionHook = undefined; } function call_signature() { // $ExpectType Deferred $.Deferred(function(deferred) { // $ExpectType Deferred this; // $ExpectType Deferred deferred; }); // $ExpectType Deferred $.Deferred(); // $ExpectType Deferred $.Deferred(function(deferred) { // $ExpectType Deferred this; // $ExpectType Deferred deferred; }); // $ExpectType Deferred $.Deferred(); // $ExpectType Deferred $.Deferred(function(deferred) { // $ExpectType Deferred this; // $ExpectType Deferred deferred; }); // $ExpectType Deferred $.Deferred(); // $ExpectType Deferred $.Deferred(function(deferred) { // $ExpectType Deferred this; // $ExpectType Deferred deferred; }); // $ExpectType Deferred $.Deferred(); } } function JQuery_Deferred() { interface J1 { kind: 'J1'; } interface J2 { kind: 'J2'; } interface J3 { kind: 'J3'; } const d1 = $.Deferred(); function promise() { const target: J1 = {} as any; d1.promise(target); // $ExpectType Promise & J1 d1.promise(); // $ExpectType Promise } } function JQuery_EffectsOptions() { $('p').show({ always(animation, jumpToEnd) { // $ExpectType HTMLElement this; // $ExpectType Animation animation; // $ExpectType boolean jumpToEnd; }, complete() { // $ExpectType HTMLElement this; }, done(animation, jumpToEnd) { // $ExpectType HTMLElement this; // $ExpectType Animation animation; // $ExpectType boolean jumpToEnd; }, duration: 5000, easing: 'linear', fail(animation, jumpToEnd) { // $ExpectType HTMLElement this; // $ExpectType Animation animation; // $ExpectType boolean jumpToEnd; }, progress(animation, progress, remainingMs) { // $ExpectType HTMLElement this; // $ExpectType Animation animation; // $ExpectType number progress; // $ExpectType number remainingMs; }, queue: true, specialEasing: { width: 'linear', height: 'easeOutBounce' }, start(animation) { // $ExpectType HTMLElement this; // $ExpectType Animation animation; }, step(now, tween) { // $ExpectType HTMLElement this; // $ExpectType number now; // $ExpectType Tween tween; } }); } function JQuery_AnimationStatic() { function call_signature() { const element: HTMLElement = undefined!; // $ExpectType Animation $.Animation(element, {}, {}); } function prefilter() { // https://github.com/jquery/api.jquery.com/issues/256 -> http://jsfiddle.net/y4L35/ { // $ExpectType void $.Animation.prefilter(function(element: HTMLElement, properties, options) { // $ExpectType Animation this; // $ExpectType HTMLElement element; // $ExpectType PlainObject properties; // $ExpectType EffectsOptions options; // $ExpectType any options.removeAfter; if (options.removeAfter) { this.done(() => { $(element).remove(); }); } }); $("#element").hide({ duration: 500, removeAfter: true, complete() { // 0, because the prefilter done happens first! console.log($(this).parent().length); } }); } } function tweener() { // $ExpectType void $.Animation.tweener('*', function(propName, finalValue) { // $ExpectType Animation this; // $ExpectType string propName; // $ExpectType number finalValue; return this.createTween(propName, finalValue); }); } } function JQuery_Animation() { const element: Element = undefined!; const animation = $.Animation(element, {}, {}); animation.done((anim, jumpedToEnd) => { // $ExpectType Animation anim; // $ExpectType true | undefined jumpedToEnd; }); animation.fail((anim, jumpedToEnd) => { // $ExpectType Animation anim; // $ExpectType false jumpedToEnd; }); animation.always((anim, jumpedToEnd) => { // $ExpectType Animation anim; // $ExpectType boolean | undefined jumpedToEnd; }); animation.progress((anim, progress, remainingMs) => { // $ExpectType Animation anim; // $ExpectType number progress; // $ExpectType number remainingMs; }); } function JQuery_TweenStatic() { function propHooks() { $.Tween.propHooks['myProp'] = { get(tween) { // $ExpectType Tween tween; return tween.elem[tween.prop as keyof typeof tween.elem]; }, set(tween) { // $ExpectType Tween tween; }, }; // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. // $ExpectError $.Tween.propHooks['myProp'] = 1; } function call_signature() { const elem: HTMLElement = undefined!; // $ExpectType Tween $.Tween(elem, {}, 'myProp', 1, 'myEasing', 'myUnit'); // $ExpectType Tween $.Tween(elem, {}, 'myProp', 1, 'myEasing'); // $ExpectType Tween $.Tween(elem, {}, 'myProp', 1); } } function JQuery_Easings() { jQuery.easing.easeInCubic = (p) => { return Math.pow(p, 3); }; } function JQuery_Effects() { function interval() { // $ExpectType number $.fx.interval; } function off() { // $ExpectType boolean $.fx.off; } function step() { // $ExpectType PlainObject> $.fx.step; } function stop() { // $ExpectType () => void $.fx.stop; function override() { let animating: boolean; jQuery.fx.stop = () => { animating = false; }; } } function timer() { // $ExpectType (tickFunction: TickFunction) => void $.fx.timer; function override() { let animating: boolean; const raf: () => void = {} as any; jQuery.fx.timer = (timer) => { // $ExpectType TickFunction timer; if (timer() && jQuery.timers.push(timer) && !animating) { animating = true; raf(); } }; } } } function JQuery_Event() { function call_signature() { // $ExpectType Event & Coordinates $.Event('keydown', $('p').offset()); } function constructor() { // $ExpectType Event & Coordinates new $.Event('keydown', $('p').offset()); } // https://stackoverflow.com/questions/49892574/trigger-a-jquery-3-event-with-ctrlkey-set function stackoverflow_49892574() { const event = $.Event("keydown"); event.which = 77; event.ctrlKey = true; $(window).trigger(event); } } function JQuery_TypeEventHandlers() { const events: JQuery.TypeEventHandlers = { change(event) { // $ExpectType HTMLElement this; // $ExpectType ChangeEvent event; }, resize(event) { // $ExpectType HTMLElement this; // $ExpectType ResizeEvent event; }, scroll(event) { // $ExpectType HTMLElement this; // $ExpectType ScrollEvent event; }, select(event) { // $ExpectType HTMLElement this; // $ExpectType SelectEvent event; }, submit(event) { // $ExpectType HTMLElement this; // $ExpectType SubmitEvent event; }, click(event) { // $ExpectType HTMLElement this; // $ExpectType ClickEvent event; }, contextmenu(event) { // $ExpectType HTMLElement this; // $ExpectType ContextMenuEvent event; }, dblclick(event) { // $ExpectType HTMLElement this; // $ExpectType DoubleClickEvent event; }, mousedown(event) { // $ExpectType HTMLElement this; // $ExpectType MouseDownEvent event; }, mouseenter(event) { // $ExpectType HTMLElement this; // $ExpectType MouseEnterEvent event; }, mouseleave(event) { // $ExpectType HTMLElement this; // $ExpectType MouseLeaveEvent event; }, mousemove(event) { // $ExpectType HTMLElement this; // $ExpectType MouseMoveEvent event; }, mouseout(event) { // $ExpectType HTMLElement this; // $ExpectType MouseOutEvent event; }, mouseover(event) { // $ExpectType HTMLElement this; // $ExpectType MouseOverEvent event; }, mouseup(event) { // $ExpectType HTMLElement this; // $ExpectType MouseUpEvent event; }, drag(event) { // $ExpectType HTMLElement this; // $ExpectType DragEvent event; }, dragend(event) { // $ExpectType HTMLElement this; // $ExpectType DragEndEvent event; }, dragenter(event) { // $ExpectType HTMLElement this; // $ExpectType DragEnterEvent event; }, dragexit(event) { // $ExpectType HTMLElement this; // $ExpectType DragExitEvent event; }, dragleave(event) { // $ExpectType HTMLElement this; // $ExpectType DragLeaveEvent event; }, dragover(event) { // $ExpectType HTMLElement this; // $ExpectType DragOverEvent event; }, dragstart(event) { // $ExpectType HTMLElement this; // $ExpectType DragStartEvent event; }, drop(event) { // $ExpectType HTMLElement this; // $ExpectType DropEvent event; }, keydown(event) { // $ExpectType HTMLElement this; // $ExpectType KeyDownEvent event; }, keypress(event) { // $ExpectType HTMLElement this; // $ExpectType KeyPressEvent event; }, keyup(event) { // $ExpectType HTMLElement this; // $ExpectType KeyUpEvent event; }, touchcancel(event) { // $ExpectType HTMLElement this; // $ExpectType TouchCancelEvent event; }, touchend(event) { // $ExpectType HTMLElement this; // $ExpectType TouchEndEvent event; }, touchmove(event) { // $ExpectType HTMLElement this; // $ExpectType TouchMoveEvent event; }, touchstart(event) { // $ExpectType HTMLElement this; // $ExpectType TouchStartEvent event; }, blur(event) { // $ExpectType HTMLElement this; // $ExpectType BlurEvent event; }, focus(event) { // $ExpectType HTMLElement this; // $ExpectType FocusEvent event; }, focusin(event) { // $ExpectType HTMLElement this; // $ExpectType FocusInEvent event; }, focusout(event) { // $ExpectType HTMLElement this; // $ExpectType FocusOutEvent event; } }; } function JQuery_EventExtensions() { function special() { jQuery.event.special.multiclick = { noBubble: true, bindType: 'click', delegateType: 'click', setup(data, namespaces, eventHandle) { // $ExpectType EventTarget this; // $ExpectType any data; // $ExpectType string namespaces; // $ExpectType EventHandlerBase> eventHandle; return false; }, teardown() { // $ExpectType EventTarget this; return false; }, add(handleObj) { // $ExpectType EventTarget this; // $ExpectType HandleObject handleObj; }, remove(handleObj) { // $ExpectType EventTarget this; // $ExpectType HandleObject handleObj; }, trigger(event, data) { // $ExpectType EventTarget this; // $ExpectType Event event; // $ExpectType any data; return false; }, _default(event, data) { // $ExpectType TriggeredEvent event; // $ExpectType any data; return false; }, handle(event, data) { // $ExpectType TriggeredEvent & { handleObj: HandleObject; } event; // $ExpectType any data; }, preDispatch(event) { // $ExpectType EventTarget this; // $ExpectType Event event; return false; }, postDispatch(event) { // $ExpectType EventTarget this; // $ExpectType Event event; } }; // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. // $ExpectError jQuery.event.special.multiclick = 1; } } declare namespace JQuery { interface ValHooks { textarea: ValHook; } } function JQuery_ValHooks() { jQuery.valHooks.textarea = { get(elem) { // $ExpectType HTMLTextAreaElement elem; return elem.value.replace(/\r?\n/g, "\r\n"); }, set(elem) { // $ExpectType HTMLTextAreaElement elem; return elem.value; } }; // Weak type test. This may be removed if the TypeScript requirement is increased to 2.4+. // $ExpectError jQuery.valHooks.textarea = function get(elem: HTMLTextAreaElement) { return elem.value.replace(/\r?\n/g, "\r\n"); }; }