let jsonObj: JSON.Obj = <JSON.Obj>(JSON.parse('{"value": 24}'));
let value: JSON.Value = jsonObj.getValue("value")!;
assert(!value.isNum)
assert(value.isInteger)
jsonObj = <JSON.Obj>(JSON.parse('{"value": 4.2}'));
value = jsonObj.getValue("value")!;
assert(value.isNum)
assert(value.isFloat)
This happens because only Float extends Num, Integer doesn't extend it.
I'm only pointing this out because the README.md's example is incorrect, since the JSON parsed in it has an Integer and not a Num:
{"hello": "world", "value": 24}
This happens because only Float extends Num, Integer doesn't extend it.
I'm only pointing this out because the
README.md's example is incorrect, since theJSONparsed in it has anIntegerand not aNum:{"hello": "world", "value": 24}