microsoft / microsoft/TypeScript

'utilities.ts' is an API surface hazard

Open
#21,258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Infrastructure
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

utilities.ts consists of 4 different namespaces:

  • one which seems to be entirely internal
  • one which is entirely exposed
  • one which is entirely exposed and is entirely type predicate functions
  • one which is a random assortment of internal and exposed functions that have no consistent usage

Just from my intuition and experience, I don't think this is a good idea. It's just too easy to put a new helper in some random section of the file and forget whether or not it's being exposed.

As a naive first approximation, here's what I think would be more appropriate for each respective namespace:

  • utilities.ts
  • publicUtilities.ts
  • publicPredicates.ts
  • I don't know, TBD.

Contributor guide

Open the contributing guide

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

Start by reading utilities.ts and catalog the four namespaces, noting which functions are internal, exposed, or type predicates. Define a consistent destination for each group, including the currently unresolved mixed namespace. Done means the utility organization and exposure boundaries are clear and consistently applied.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.