Skip to content

Checker: same-named enums with incompatible member values are assignable #3555

Closed

Description

@nickna

Reproduction

namespace First { export enum E { A = 1 } }
namespace Second { export enum E { A = 2 } }
function use(value: Second.E) { return value; }
use(First.E.A);

SharpTS exits successfully at main a3683d903 with --no-tsconfig --strict --noEmit case.ts. TypeScript 6.0.3 reports TS2345 with --ignoreConfig --strict --noEmit case.ts because the two enum members have different values.

The checker uses the enum's simple name for compatibility and for its cache key. The same acceptance reproduces on PR #3552 before any review changes. #3532 concerns a separate compiler binding identity problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions