Skip to content

Conversation

@puppy0cam
Copy link

Fixes #33525

Copilot AI review requested due to automatic review settings October 25, 2025 10:48
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Oct 25, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Oct 25, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where imports used only in computed property names of abstract class members were not being properly elided during compilation. Abstract members don't generate runtime code, so their imports should be removed when they're only used in type-only contexts.

Key Changes:

  • Added logic to detect when an identifier is used within a computed property name of an abstract member
  • Modified the alias reference marking to skip identifiers in abstract member computed properties, allowing their imports to be elided

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/compiler/checker.ts Added isIdentifierInAbstractMemberComputedPropertyName helper function and integrated it into markIdentifierAliasReferenced to prevent marking imports as referenced when used only in abstract member computed properties
tests/cases/compiler/abstractMethodComputedPropertyElision.ts Added compiler test demonstrating the fix with both type-only and normal imports using symbols in abstract computed properties
tests/baselines/reference/abstractMethodComputedPropertyElision.types Baseline file for type checking output of the test case
tests/baselines/reference/abstractMethodComputedPropertyElision.symbols Baseline file for symbol resolution output of the test case
tests/baselines/reference/abstractMethodComputedPropertyElision.js Baseline file showing the compiled JavaScript output where imports are correctly elided
Comments suppressed due to low confidence (1)

src/compiler/checker.ts:1

  • [nitpick] The condition spans multiple lines with inconsistent parentheses grouping. The logical grouping (isMethodDeclaration || isMethodSignature || isPropertyDeclaration || isPropertySignature) should be fully enclosed in parentheses before the && operator for clarity.
import {

@puppy0cam

This comment was marked as resolved.

@RyanCavanaugh
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 28, 2025

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Oct 28, 2025

Hey @RyanCavanaugh, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/166394/artifacts?artifactName=tgz&fileId=861667B114E58349175ECC655360A8F182ED1A65E0D995FD2ABC530A79AE318002&fileName=/typescript-6.0.0-insiders.20251028.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/pr-build@6.0.0-pr-62673-3".;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Abstract classes will still import the value for a computed property at runtime

3 participants