ts-reset icon indicating copy to clipboard operation
ts-reset copied to clipboard

Worth making parameters for JSON.parse's reviver and JSON.stringify's replacer use `unknown` instead of `any`?

Open EskiMojo14 opened this issue 2 years ago • 1 comments

using unknown for JSON.parse's return type makes total sense, as you have no idea what you will get.

equally, you have no idea what the reviver (or replacer) will be called with. using unknown would force you to check what the function was called with, before doing any important reviving/replacing logic.

love the library by the way! 😄

EskiMojo14 avatar Feb 19 '23 20:02 EskiMojo14

The same is for String.prototype.replace/String.prototype.replaceAll (args in replacer)

Semigradsky avatar Feb 23 '23 11:02 Semigradsky