microsoft / microsoft/TypeScript

Bloomberg feedback for 5.8

Abierto
#61,226 1 comentario 5 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Discussion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

Acknowledgement
  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment

We evaluated the 5.8 beta and RC releases and 5.8 seems to be a low impact release for us.

We are excited to adopt the new flag --erasableSyntaxOnly for the improved Editor experience for features we already avoid. A significant number of our projects already comply with the corresponding rules due to custom error checks that will happily become redundant. We remain interested in gaining the ability to use first-class enums that comply with the TS=JS+types model. For example via the erasable as enum syntax proposal.

# Change Affects Release notes Packages affected
1 Computed properties with a non literal type now appear in declarations Declaration Emit Yes >1%
2 Better type checking of conditional expressions Type Checking No Yes ~1-2%
Computed properties with a non literal type now appear in declarations

Some declaration files changed and now preserve computed properties where index signatures would previously be created. This is an expected change and part of ongoing Isolated Declarations work.

// index.ts
export let foo = "x"
export class Bar {
    [foo]: string
}

// index.d.ts
export declare let foo: string;
export declare class Bar {
    // in 5.8
    [foo]: string;
    // in 5.7
    [x: string]: string;
}
Better checking in conditional expressions

We observed roughly a dozen new compile errors relating to improved conditional return checking.

While not directly announced the change seems related to Checked Returns for Conditional and Indexed Access Types

In TypeScript 5.7 and before, if a branch of a conditional expression returned any we would not get an error if we returned the wrong type on the other branch. Now we do, at least if the expression is in the return of a function:

declare const data: number | string | undefined;
const  result = (): number =>
    typeof data === 'string'
        ? null as any
        : data; // Error now


const  result2: number =  
    typeof data === 'string'
        ? null as any
        : data; // Still not an error ? 😕

Link

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza reproduciendo el ejemplo de expresión condicional en el TypeScript Playground enlazado usando 5.7.3 y 5.8; después, compara entre versiones el ejemplo de declaration emit indicado. El issue documenta el comportamiento observado, pero no nombra ningún archivo fuente, prueba ni cambio específico deseado, por lo que para completarlo sería necesaria la orientación de un maintainer sobre si alguno de los dos comportamientos es incorrecto.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
compilers
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.