microsoft / microsoft/TypeScript
tsconfig.json option removeComments removes comments from both declaration.d.ts and source .js files, it would be convenient to only remove comments from .js files.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Suggestion
The TypeScript tsconfig.json removeComments removes all comments from both declaration and source files. It would be convenient to be able to specify removeCommentsFromDeclaration (.d.ts) and removeCommentsFromModule (.js) independently.
🔍 Search Terms
removeComments
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
Source .js files are used directly when importing packages and do not need comments as these can contribute to the size.
It is often undesirable to show off internal comments, especially when developing external libraries.
Declaration .d.ts files are used for IntelliSense and it is usually desired for them to have comments, api-extractor uses generated declarations for documentation extraction.
While there are work arounds, they require running additional commands instead of getting everything in one go.
Provide removeCommentsFromDeclaration (.d.ts) and removeCommentsFromModule (.js) options alongside the existing removeComments OR allow removeComments to be overloaded to have ["declaration", "module"] to specify the specific comments to remove.
📃 Motivating Example
Remove comments from .js to:
- reduce size of the package when uploaded to NPM and downloaded from NPM
- reduce size of packages on disk
- reduce size of imports without post processing
- hide internal package comments from external developers
💻 Use Cases
The workaround is to have the .d.ts and .js be potentially out of sync by running two separate commands to generate the .d.ts and .js files.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Option removeComments in tsconfig.json und vergleiche die Ausgabe von Deklarationen (.d.ts) und Quellcode (.js). Ermittle, ob separate Optionen oder ein überladener Wert die Kommentare unabhängig voneinander steuern sollten, und verifiziere anschließend, dass das bestehende Verhalten unverändert bleibt und beide Ausgabetypen wie gewünscht konfiguriert werden können.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100