mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
Merge pull request #2199 from styfle/patch-4
$.parseJSON should return `any` instead of `Object`
This commit is contained in:
@@ -3116,6 +3116,22 @@ function test_parseHTML() {
|
||||
.appendTo( $log );
|
||||
}
|
||||
|
||||
// http://api.jquery.com/jQuery.parseJSON/
|
||||
function test_parseJSON() {
|
||||
// Return type should be any, not Object
|
||||
var i = $.parseJSON('1');
|
||||
var a = $.parseJSON('[1]');
|
||||
var o = $.parseJSON('{"foo":"bar"}');
|
||||
var s = $.parseJSON('"string"');
|
||||
var n = $.parseJSON('null');
|
||||
|
||||
i instanceof Object; // false
|
||||
a instanceof Object; // true
|
||||
o instanceof Object; // true
|
||||
s instanceof Object; // false
|
||||
n instanceof Object; // false
|
||||
}
|
||||
|
||||
function test_not() {
|
||||
$("li").not(":even").css("background-color", "red");
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1214,7 +1214,7 @@ interface JQueryStatic {
|
||||
*
|
||||
* @param json The JSON string to parse.
|
||||
*/
|
||||
parseJSON(json: string): Object;
|
||||
parseJSON(json: string): any;
|
||||
|
||||
/**
|
||||
* Parses a string into an XML document.
|
||||
|
||||
Reference in New Issue
Block a user