microsoft / microsoft/TypeScript
Missing computed properties in declaration emit
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
With #60052, we now emit qualified names rather than generate an index signature for computed names in classes; however, this now puts us in an awkward place where regardless of errors, declaration emit diverges on isolatedDeclarations.
Playground Links:
- 5.7, without
isolatedDeclarations - Nightly, without
isolatedDeclarations - Nightly, with
isolatedDeclarations
export const greeting: unique symbol = Symbol();
export const count: unique symbol = Symbol();
export class MyClass1 {
[greeting]: string = "world";
[count]: number = 42;
}
export enum PropertyNames {
greeting = "greeting",
count = "count",
}
export class MyClass2 {
[PropertyNames.greeting]: string = "world";
[PropertyNames.count]: number = 42;
}
export let prop!: string;
export class MyClass3 {
[prop]: () => void = () => {}
}
Compared to --isolatedDeclarations false The declaration emit lacks expected contents in MyClass1 and MyClass2:
export declare const greeting: unique symbol;
export declare const count: unique symbol;
export declare class MyClass1 {
- [greeting]: string;
- [count]: number;
}
export declare enum PropertyNames {
greeting = "greeting",
count = "count"
}
export declare class MyClass2 {
- [PropertyNames.greeting]: string;
- [PropertyNames.count]: number;
}
export declare let prop: string;
export declare class MyClass3 {
[prop]: () => void;
}
It is surprising that prop is emitted regardless of --isolatedDeclarations, but not the other contents.
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
Inizia con il comportamento di emissione delle dichiarazioni TypeScript mostrato nei link del Playground, confrontando l’output con e senza --isolatedDeclarations per MyClass1, MyClass2 e MyClass3. Analizza la gestione delle proprietà calcolate e fai in modo che l’emissione delle dichiarazioni mantenga le proprietà calcolate previste, preservando al contempo il comportamento attuale di prop; verifica il diff della dichiarazione emessa rispetto all’esempio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100