microsoft / microsoft/vscode-languageserver-node

Reduce number of d.ts files and types published in packages

Open
#1,121 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
TypeScript
Stars
1.8k
Forks
404
Avg merge
2d 8h
Merged PRs (30d)
14

Description

Problem

The published npm package for vscode-languageclient currently includes a d.ts file for every .js file under lib:

Screen Shot 2022-11-10 at 4 34 13 PM

This is problematic for two reasons:

  • It bloats the package size. All the d.ts files in vscode-languageclient take up 300KB or so

  • We are likely publishing interfaces and types that are not meant to be exposed externally. For example, there are files like utils/async.d.ts.

Proposed fix

To fix this, I suggest adopting a tool such as api extractor. This lets you bundle all the types for a project into a single d.ts file. You can also control which types are exposed and which ones stay internal

I adopted this for the markdown language service: https://github.com/microsoft/vscode-markdown-languageservice/blob/main/api-extractor.json

This helped me make sure I only exposed a well defined API to library consumers

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

Start by inspecting the declarations generated for lib, including the example utils/async.d.ts, and compare the proposed approach with the referenced api-extractor.json configuration. Done means the published packages expose only the intended types, consolidate declarations, and reduce the current package bloat.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
build-system, release
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.