microsoft / microsoft/TypeScript

Cache Declarations Directory

Open
#60,905 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

🔍 Search Terms

cache declarations cached tsserver tsc

✅ Viability Checklist
⭐ Suggestion

A cache directory for declaration files that can be used both for normal type declaration and for tsserver.

This would be a shared folder to use for type definitions in development and possibly for build steps.

A separate folder could mean you have one service that could have it's own optimizations running in parallel or for some part of the project and emitting the declaration files, while the rest is worked normally or even tsserver rely only those declarations.

📃 Motivating Example

https://github.com/trpc/trpc/discussions/2448#discussioncomment-11151754

💻 Use Cases

With tools that relies heavily on TS, some projects see inference times of seconds and have to rely on splitting code into a monorepo or some indirect compilation step and then depending on those types.

  1. What do you want to use this for?

Faster inference in large projects with tooling with complex, nested types.

  1. What shortcomings exist with current approaches?

Some relies on splitting code into a monorepo, others you need multiple tsconfigs so you can generate the types in one place and then reference them in the actual code, making indirections on the type system to keep the inference speed.

  1. What workarounds are you using in the meantime?

Have a parallel config to generate types and change a critical entrypoint to use the generated types instead of the normally inferred one.

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 reviewing the suggestion, use cases, and linked trpc discussion to clarify the required declaration-cache behavior. Done would require a defined shared cache directory that supports normal declaration use, tsserver, and possibly build steps, with the scope and integration points specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
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.