microsoft / microsoft/TypeScript
Replace any by unknown in definition files
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Since the new unknown type was added, it makes sense to replace a lot (if not all) usage of any in the definition files with unknown. For example:
Array.isArray(a: unknown): a is unknown[];
JSON.parse(a: string): unknown;
However, this change will cause many errors in projects currently using the fact that the returned types are not type-checked. This means that the change could be controversial.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no specific definition files or tests. Start by locating the definition files that use any and review the compatibility impact of replacing it with unknown; done requires an agreed scope for the replacement and validation that the resulting definitions preserve intended compatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100