microsoft / microsoft/TypeScript
Feature Request: Line Breaks in Assignments in Compiled Javascript
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
One of typescript's key advantages over Babel (at least as far as I'm concerned), is the readability of its compiled javascript. It is so readable, in fact, that I often use typescript for non-typescript projects, and just submit the compiled javascript. One issue that often arises, however, is that the compiled javascript will not match style rules in these javascript projects. One style rule is to have each assignment on its own line. Typescript generally does this, except when destructuring. It would be extremely valuable to be able to specify a compiler option for assignmentsOnNewLine which would add line breaks after each assignment.
For example, the following typescript code:
const aVeryLargeObject = {
firstValue: 1,
secondValue: 2,
thirdValue: 3,
fourthValue: 4
};
const {firstValue, secondValue, thirdValue, fourthValue} = aVeryLargeObject;
Produces the following javascript:
var aVeryLargeObject = {
firstValue: 1,
secondValue: 2,
thirdValue: 3,
fourthValue: 4
};
var firstValue = aVeryLargeObject.firstValue, secondValue = aVeryLargeObject.secondValue, thirdValue = aVeryLargeObject.thirdValue, fourthValue = aVeryLargeObject.fourthValue;
If this feature was implemented it should produce the following javascript:
var aVeryLargeObject = {
firstValue: 1,
secondValue: 2,
thirdValue: 3,
fourthValue: 4
};
var firstValue = aVeryLargeObject.firstValue,
secondValue = aVeryLargeObject.secondValue,
thirdValue = aVeryLargeObject.thirdValue,
fourthValue = aVeryLargeObject.fourthValue;
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
Verwende die TypeScript- und JavaScript-Beispiele des Issues als Verhaltensreferenz und ermittle anschließend die Destructuring-Ausgabe des Compilers sowie die Definitionen der Compileroptionen. Die Aufgabe ist abgeschlossen, wenn die Option unterstützt wird, die ausgegebenen Zuweisungen die angeforderten Zeilenumbrüche verwenden und Tests die gezeigte Ausgabe abdecken.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100