Skip to content

Const enum initializers reject qualified enum member references #3630

Closed

Description

@nickna
const enum First { A = 4 }
const enum Second { B = First.A }
console.log(Second.B);

TypeScript 6.0.3 accepts this with --ignoreConfig --strict --target ES2022. Its emitted JavaScript prints 4. SharpTS at 72455db66 rejects it with --no-tsconfig --strict --noEmit and reports Expression type 'Get' is not allowed in const enum initializer.

A member of another const enum should be available as a compile-time enum initializer value. Found while verifying #3620, which covers const variable references. #3605 covers the regular enum case.

Activity

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

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