mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
$.parseJSON should return any instead of Object
Here is my test:
```js
var i = JSON.parse('1');
var a = JSON.parse('[1]');
var o = JSON.parse('{"foo":"bar"}');
var s = JSON.parse('"string"');
var n = JSON.parse('null');
i instanceof Object; // false
a instanceof Object; // true
o instanceof Object; // true
s instanceof Object; // false
n instanceof Object; // false
```
JSON.parse returns the `any` type so I think this method should do the same.
More of the discussion regarding this pull request can be found on the original commit 8c23d04a5b
https://github.com/borisyankov/DefinitelyTyped/commit/8c23d04a5b4a0505df042a82be90f95adff02d87
This commit is contained in:
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