diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 03c8d18360..f55232e43e 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -706,6 +706,42 @@ function JQuery() { } } + function data() { + function data() { + // $ExpectType any + $('p').data('myData', undefined); + + // $ExpectType JQuery + $('p').data('myData', {}); + + // $ExpectType JQuery + $('p').data({ + myData1: {}, + myData2: false + }); + + // $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 on() { function false_handler_shorthand() { $().on('events', false);