microsoft / microsoft/TypeScript
Isolated declarations uses type information when emitting computed object keys
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔎 Search Terms
- isolated declarations
- computed keys
- object literals
🕗 Version & Regression Information
5.5.0-dev.20240514
⏯ Playground Link
💻 Code
export const Key = "theKey";
declare global {
export const GlobalKey = "theGlobalKey"
export const UniqueSymbol: unique symbol;
export const NonUniqueSymbol: symbol;
}
export const A = {
[Key]: true,
[Symbol.toStringTag]: false,
[UniqueSymbol]: false,
[GlobalKey]: false,
}
🙁 Actual behavior
TypeScript is emitting the computed property keys with type information that can not be determined without a type checker.
export declare const Key = "theKey";
declare global {
export const GlobalKey = "theGlobalKey";
export const UniqueSymbol: unique symbol;
export const NonUniqueSymbol: symbol;
}
export declare const A: {
theKey: boolean;
[Symbol.toStringTag]: boolean;
[UniqueSymbol]: boolean;
theGlobalKey: boolean;
};
🙂 Expected behavior
export declare const Key = "theKey";
declare global {
export const GlobalKey = "theGlobalKey";
export const UniqueSymbol: unique symbol;
export const NonUniqueSymbol: symbol;
}
export declare const A: {
[Key]: true,
[Symbol.toStringTag]: false,
[UniqueSymbol]: false,
[GlobalKey]: false,
};
Additional information about the issue
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der verknüpften Playground-Reproduktion und dem Pfad für isolated-declarations zur Deklarationsausgabe. Vergleiche die tatsächliche und die erwartete Ausgabe für berechnete Schlüssel, die String-Konstanten, Symbol.toStringTag, eindeutige Symbole und globale Konstanten betreffen; abgeschlossen bedeutet, dass die ausgegebene Deklaration die berechneten Schlüssel beibehält, ohne Typinformationen zu benötigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100