microsoft / microsoft/TypeScript

Export a object with comment ,but the comment is missing after build a *.d.ts file

Open
#28,514 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I export an object,then I build to a declare file like index.d.ts,but the file has no comment about that object.

Source code
//src/cache/index.ts
import * as  localStorage from "./localStorage"
export default {
    /**
     * This is a comment2
     */
    localStorage
}

//src/index.ts
import cache from "./cache/index"
export default {
    /**
     * This is a comment1
     */
    cache
}
Index.d.ts
declare const _default: {
    /**
     * This is a comment1
     */
    cache: {
        localStorage: typeof import("./cache/localStorage");//#### This field's comment is missing ####
    };
};
export default _default;

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

Reproduce the declaration build from src/index.ts and src/cache/index.ts, then compare the generated index.d.ts with the source comments. Trace the declaration-emission path for the nested localStorage property; done means its comment is preserved in the generated declaration file.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.