microsoft / microsoft/TypeScript
Feature Request: Line Breaks in Assignments in Compiled Javascript
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
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;
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Usa los ejemplos de TypeScript y JavaScript del issue como referencia de comportamiento y, después, localiza la emisión de destructuring del compilador y las definiciones de las opciones del compilador. El trabajo está terminado cuando la opción sea compatible, las asignaciones emitidas usen los saltos de línea solicitados y haya pruebas que cubran la salida mostrada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, typescript
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100