microsoft / microsoft/TypeScript

Bloomberg feedback for 5.9

Aperta
#62,156 1 commento 7 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Discussion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Comment

We evaluated the 5.9 RC releases and 5.9 is a low impact release for us.

# Change Affects Release notes Packages affected PR / Issue
1 Class expressions with private fields produce invalid .d.ts output Declaration Emit No <1% #62153
2 Promise.all over constant tuples no longer infers tuple Type Checking No <1% #62071
3 JavaScript emit removes parentheses around ?? in conditional expressions Emit No <1%
4 Better detection of always-true errors in ?? expressions Type Checking No <1%

Class expressions with private fields produce invalid .d.ts output

With TypeScript 5.9, the following code:

export const ClassExpression = class {
    #context = 0
};

Produces invalid declaration output:

export declare const ClassExpression: {
    new (): {
        #context: number;
    };
};

5.8 output was also incorrect but at least syntactically valid:

export declare const ClassExpression: {
    new (): {
        "__#1@#context": number;
    };
};

❗This seems like a major regression, since emitted declarations are now invalid.
Tracked in #62153

Promise.all over array literal no longer infers a tuple

This issue is easier to reproduce than the linked ticket may suggest. It affects any use of Promise.all in the return position of a .then() that chains from a promise resolving to an array:

const p = Promise.resolve([]).then(() => {
    return Promise.all([0, ""]);
});
const test: Promise<[number, string]> = p; // error

This now fails to infer a tuple and infers Promise<(string | number)[]> instead.
While we can work around this issue by assigning the result of Promise.all to an intermediate variable, this does seem like an unfortunate regression.

Tracked in #62071

JavaScript emit removes parentheses around ?? in conditional expressions

In some cases, parentheses are removed from nullish coalescing expressions in emitted JavaScript. This change seems benign.

(test ?? true) ? A : B

Becomes:

test ?? true ? A : B

Better detection of always-true errors in ?? expressions

We observed two new diagnostics related to always-true ?? expressions.
The improved detection highlighted logic errors that were previously missed.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con gli snippet di riproduzione nell’issue e con i ticket collegati #62153 e #62071, che tracciano due delle regressioni segnalate. Confronta il comportamento delle dichiarazioni o del type-checking tra 5.8 e 5.9, quindi limita qualsiasi lavoro a una regressione confermata; il report non identifica file, test o una singola Definition of done.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
compilers
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
15/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.