Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaration emit not dropping untyped computed property name #58583

Closed
acutmore opened this issue May 20, 2024 · 0 comments Β· Fixed by #58646
Closed

Declaration emit not dropping untyped computed property name #58583

acutmore opened this issue May 20, 2024 · 0 comments Β· Fixed by #58646
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Fix Available A PR has been opened for this issue Recent Regression This is a new regression just found in the last major/minor version of TypeScript.

Comments

@acutmore
Copy link
Contributor

acutmore commented May 20, 2024

πŸ”Ž Search Terms

declaration, dts, ambient, computed property

πŸ•— Version & Regression Information

  • This changed between versions 5.5.0-beta and 5.5.0-dev.20240514

⏯ Playground Link

https://www.typescriptlang.org/dev/bug-workbench/?ts=5.5.0-dev.20240520#code/PTAEAEGcAsHsHcCiBbAlgFwFAgjBKN0BTAEwDFUAbIgLlGQENUA7AOhNfUmzHBKIDGlBgCcG6VLGaYeEAGZUizBslqgVAI1RL07Tt35DRRerBIBXaqABEDDQP5yA5tGsBuGTnALqy1XUYWfUxUZAAHWBF0UAAVIkhouRFYZBs7ByJnVw9MIgAPCKjQI0hIUABhUABvTFA60ABtOITWSBSiAGkiAE8AXQAKAEpqgF8PEcwgA

πŸ’» Code

// @showEmit
// @showEmittedFile: main.d.ts
// @declaration

// @filename: ambient.d.ts
declare module "abcdefgh";

// @filename: main.ts
import Test from "abcdefgh";

export class C {
    [Test.someKey]() {};
}

πŸ™ Actual behavior

// main.d.ts
import Test from "abcdefgh";
export declare class C {
    [Test.someKey](): void;
    // ❌ error 1165: A computed property name in an ambient context must refer to an expression whose type is a literal type or a 'unique symbol' type.
}

πŸ™‚ Expected behavior

// main.d.ts
export declare class C {
}

Or alternatively it would now be an error.

Additional information about the issue

Note: this is an error when isolatedDeclarations is enabled: https://www.typescriptlang.org/play/?isolatedDeclarations=true&ts=5.5.0-dev.20240520#code/CYUwxgNghgTiAEA3W8AqIDOAXAXPKAdgJ4DcAUGSAB4AOA9jFvJFBhvAMLwDeZ8-8ANrpsAOgx0AtiADSIIgF0AFAEo8hIjwC+5LWSA

@weswigham weswigham added Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Recent Regression This is a new regression just found in the last major/minor version of TypeScript. labels May 23, 2024
@weswigham weswigham added this to the TypeScript 5.5.1 milestone May 23, 2024
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Fix Available A PR has been opened for this issue Recent Regression This is a new regression just found in the last major/minor version of TypeScript.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants