microsoft / microsoft/TypeScript

inline comments are striped in emitted declaration files

Open
#28,199 3 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

TypeScript Version: 3.1.3

Search Terms: inline comments striped

tsconfig

{
  "compilerOptions": {
    "moduleResolution": "node",
    "module": "esnext",
    "target": "es5",
    "lib": [
      "dom",
      "es2018"
    ],
    "strict": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "suppressImplicitAnyIndexErrors": true,
    "forceConsistentCasingInFileNames": true,
    "jsx": "react",
    "sourceMap": true,
    "outDir": "dist/esm5",
    "declaration": true,
    "declarationDir": "dist/types",
    "declarationMap": true,
    "stripInternal": true,
    "resolveJsonModule": true,
    "importHelpers": true
  },
  "include": [
    "./src"
  ],
  "compileOnSave": false,
  "buildOnSave": false
}

Code:

// I'll be missing after tsc 😭

/**
 * I'll be here after tsc 😎
 */

export const api = () => { /* some code ... */ } 

Expected behavior:

Keeping both block and inline comments in declaration files in both transpiled files and declaration files

Actual behavior:

Inline comments are removed in declaration files
image

And correctly kept within transpiled files
image

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 reproducing the issue with the provided tsconfig and TypeScript example, using TypeScript 3.1.3 or typescript@next. Compare the emitted declaration files with the transpiled files; done means inline comments are retained in declaration output alongside block comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.