espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.74k stars 741 forks source link

readJSON typescript: prevent `any` propagation #2378

Closed bobrippling closed 1 year ago

bobrippling commented 1 year ago

This tweaks the readJSON type to indicate that (when we're in the object-or-exception case), we get back unknown, prompting the developer to cast the json to the appropriate type, rather than any making its way through their code.

In the non-exception case of readJSON(..., 1), we also have undefined as a possible return value.

gfwilliams commented 1 year ago

Thanks!