Skip to content

typescript: impact of an enum member lists switches over other enums that share the member name as [resolved] #1589

Closed as duplicate

Description

@swapnilpaliwal-sd

Symptom

impact <Enum>.<MEMBER> on a TypeScript enum member lists, as [resolved] "switches over the enum" users, functions whose switch is over a different enum that happens to declare a member of the same name.

Repro

// kinds.ts
export enum OwnerKind { METHOD = 'METHOD', FIELD = 'FIELD' }
export enum ReceiverKind { METHOD = 'METHOD', SELF = 'SELF' }

// a.ts
import { OwnerKind } from './kinds';
export function ownerLabel(k: OwnerKind): string {
  switch (k) { case OwnerKind.METHOD: return 'm'; default: return 'f'; }
}

// b.ts
import { ReceiverKind } from './kinds';
export function receiverLabel(k: ReceiverKind): string {
  switch (k) { case ReceiverKind.METHOD: return 'm'; default: return 's'; }
}

axiomcode impact OwnerKind.METHOD

Expected: ownerLabel only.

Actual: both ownerLabel and receiverLabel are listed as [resolved] … switches over the enum (1 of its constants named). On a multi-language parser codebase with ~20 *Kind enums, impact of one enum member returned 29 [resolved] "switches over the enum" rows, and at least two I checked by reading (a switch over a binding-kind enum, a switch over a receiver-kind enum) never mention the target enum.

Control

A switch over the target enum itself must stay [resolved].

Activity

  1. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Consolidated into #1585, which tracks this issue together with related ones about TypeScript typing and entry points: callbacks, object-literal functions, enums, JSX and package exports. The description and reproduction here still apply, and the fix for the group covers them.

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

Metadata

Metadata

Labels

bugSomething isn't workingengineResolution / call-graph engine rulestypescriptTypeScript

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions