From 680f2fa69ba280f23445bee740d6b7c29eae10e9 Mon Sep 17 00:00:00 2001 From: Diullei Gomes Date: Thu, 11 Jul 2013 20:33:29 -0300 Subject: [PATCH 1/2] Bug fix - #764 'require.config(...)' should return type 'Require' --- requirejs/require-tests.ts | 7 ++++++- requirejs/require.d.ts | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/requirejs/require-tests.ts b/requirejs/require-tests.ts index 182ff785c..5788eabeb 100644 --- a/requirejs/require-tests.ts +++ b/requirejs/require-tests.ts @@ -36,4 +36,9 @@ require(['main'], (main, $, _, Backbone) => { var app = main.AppMain(); app.run(); -}); \ No newline at end of file +}); + +// ISSUE: https://github.com/borisyankov/DefinitelyTyped/issues/764 +var recOne = requirejs.config({ baseUrl: 'js' }); +recOne(['core'], function (core) {/*some code*/}); + diff --git a/requirejs/require.d.ts b/requirejs/require.d.ts index ed9fbad28..711321b7d 100644 --- a/requirejs/require.d.ts +++ b/requirejs/require.d.ts @@ -126,8 +126,8 @@ interface RequireMap { interface Require { - // Configure require.js - config(config: RequireConfig): void; + // Configure require.js + config(config: RequireConfig): Require; // Start the main app logic. // Callback is optional. From 106cf5e16f40a7c15a32e44170e19230b2319f03 Mon Sep 17 00:00:00 2001 From: Diullei Gomes Date: Fri, 12 Jul 2013 00:29:42 -0300 Subject: [PATCH 2/2] bug fix - #742 JQueryAjaxSettings does not allow contentType set to false --- jquery/jquery-tests.ts | 14 ++++++++++++++ jquery/jquery.d.ts | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 4fb31f0ed..db8309e06 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -2302,3 +2302,17 @@ $.when("asdf", "jkl;").done(x => x.length, x=> x.length); var f1 = $.when("fetch"); // Is type JQueryPromise var f2: JQueryPromise = f1.then(s => [s, s]); var f3: JQueryPromise = f2.then(v => 3); + +// ISSUE: https://github.com/borisyankov/DefinitelyTyped/issues/742 +// http://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax#answer-5976031 +$.ajax({ + url: 'php/upload.php', + data: {}, + cache: false, + contentType: false, + processData: false, + type: 'POST', + success: function (data) { + alert(data); + } +}); \ No newline at end of file diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 57dfff6be..1f1969814 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -25,7 +25,9 @@ interface JQueryAjaxSettings { cache?: boolean; complete? (jqXHR: JQueryXHR, textStatus: string); contents?: { [key: string]: any; }; - contentType?: string; + //According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false" + // https://github.com/borisyankov/DefinitelyTyped/issues/742 + contentType?: any; context?: any; converters?: { [key: string]: any; }; crossDomain?: boolean;