-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Open
Labels
Domain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: flag: isolatedDeclarationsRelated to the --isolatedDeclarations compiler flagRelated to the --isolatedDeclarations compiler flagPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases
Description
π 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
Metadata
Metadata
Assignees
Labels
Domain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesDomain: flag: isolatedDeclarationsRelated to the --isolatedDeclarations compiler flagRelated to the --isolatedDeclarations compiler flagPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some casesThe current behavior isn't wrong, but it's possible to see that it might be better in some cases