web-infra-dev / web-infra-dev/rslib

[Bug]: `declare` statements are not preserved which breaks API extending for 3rd-party modules

Open
#794 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api-extractor
Dominant language
TypeScript
Stars
1k
Forks
67
Avg merge
6h 9m
Merged PRs (30d)
57

Description

Version
  System:
    OS: Linux 6.1 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (2) x64 AMD EPYC
    Memory: 2.74 GB / 4.14 GB
    Container: Yes
    Shell: Unknown
  npmPackages:
    @rslib/core: ^0.5.1 => 0.5.1
Details

Input:

declare global {
  const x: string;
}

declare module "unist" {
  interface Data {
    key: string;
  }
}

export * from "./test";

Output:

export declare const y: string;

export { }
Reproduce link

https://codesandbox.io/p/devbox/thirsty-leftpad-h3fczd

Reproduce Steps

npm run build

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 with the TypeScript input and output shown in the issue, then run the provided CodeSandbox reproduction with npm run build. Compare how the declare global and declare module statements are handled; done means those declarations are preserved while the API extension remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.