microsoft / microsoft/TypeScript

Idea: Distinguish between build-signature declarations and for-publication declarations

Open
#44,047 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Some declaration files are intended for publication and they need to be readable and "work" (e.g. no imports from node_modules). Others are, from a user's perspective, basically temporary files produced by the build to make subsequent builds more incremental (i.e. faster). Right now, we produce both sets of declaration files in the same way, but maybe we don't need to? As far as I can tell, the characteristics we require from "build" declarations are:

  1. They change if-and-only-if the API of the underlying code changes
  2. A source map can get you back from the declaration file to the input file

We can satisfy these requirements without, e.g.

  1. Pretty-printing
  2. Adding imports (as in #44044)
  3. Confirming that referenced types are actually accessible (simplifying #44045)
  4. Complaining about node_modules imports

One likely snag is how users will opt in to this behavior (Is it enough to be composite/incremental without having declarations? Is yet another switch required?).

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 the issue's distinction between build-signature and publication declarations, then investigate the existing composite/incremental and declarations behavior. Review the related discussions in #44044 and #44045. Done would require a decided opt-in design and implementation that preserves API-change tracking and source-map navigation while relaxing publication-only checks for build declarations.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, compilers
Issue type
Feature
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.