Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

No, it is not possible to prevent any from being returned in a JSON.parse reviver, as the reviver function does not have full control over the parsed JSON. The any type is used in TypeScript to represent any type and can be returned if the JSON data contains values that cannot be parsed into a specific type. However, you can type-check the result of the JSON.parse function and handle the any values properly.