From 78fb12aee8919dd88616a470b05dba68aca8211c Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Mon, 8 Oct 2018 16:26:24 -0400 Subject: [PATCH] [jquery] Add `jQuery.getScript(options)`. See https://github.com/jquery/api.jquery.com/issues/1052. --- types/jquery/index.d.ts | 8 ++++++++ types/jquery/jquery-tests.ts | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 717827b977ab5b..25649c052aa1c0 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -1839,6 +1839,14 @@ $.getScript( url, function() { */ getScript(url: string, success?: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * + * @see \`{@link https://api.jquery.com/jQuery.getScript/ }\` + * @since 1.12 + * @since 2.2 + */ + getScript(options: JQuery.UrlAjaxSettings): JQuery.jqXHR; /** * Execute some JavaScript code globally. * diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index df1d9d97afc756..a50343968b6dcb 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -576,6 +576,11 @@ function JQueryStatic() { // $ExpectType jqXHR jqXHR; }); + + // $ExpectType jqXHR + $.getScript({ + url: 'url', + }); } function globalEval() {