microsoft / microsoft/TypeScript
Feature Request: Line Breaks in Assignments in Compiled Javascript
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
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;
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Usa gli esempi TypeScript e JavaScript dell'issue come riferimento comportamentale, quindi individua l'emissione del destructuring del compilatore e le definizioni delle opzioni del compilatore. Il lavoro è completato quando l'opzione è supportata, le assegnazioni emesse usano le interruzioni di riga richieste e i test coprono l'output mostrato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100