microsoft / microsoft/TypeScript

Much better comment preservation

Open
#38,539 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

some comments are removed (even even removeComments to false)

TypeScript Version: Version 3.9.1-rc

Search Terms:
Much better comment preservation

Code

// my comment 1
import { something } from './somefile.js';
// my comment 2
declare let test1: something;
let test = new something( {} );

// also
let item = [
    // my comment 3
        { a: 0 },
	{ a: 0 },
	{ a: 0 },
    // my comment 4
];

**Expected behavior:**
// my comment 1
import { something } from './somefile.js';
// my comment 2
let test = new something( {} );

// also
let item = [
    // my comment 3
    { a: 0 },
    { a: 0 },
    { a: 0 },
   // my comment 4
];

Actual behavior:

// my comment 1
import { something }from '/lib/backend/./somefile.js';
let test = new something({});

// also
let item = [
    // my comment 3
    { a: 0 },
    { a: 0 },
    { a: 0 },
];

Related Issues:
sound like previous bugs report but not.
#1665
#16727

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 reproduction in the issue and compare its emitted JavaScript with the expected output, focusing on the comments that disappear. Done means the relevant comments are preserved while the shown import and formatting behavior remain correct.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.