mattpocock / mattpocock/ts-reset

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

Open
#6 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs-triage
Dominant language
TypeScript
Stars
8.6k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

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! 😄

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue targets the reviver parameter of JSON.parse and the replacer parameter of JSON.stringify, proposing unknown instead of any. Start by locating ts-reset's type changes for these APIs and reviewing the relevant TypeScript declarations; done means determining whether the change is compatible and validating the resulting types.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.