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

TS2322: Why symbol type is not allowed with enum type? #24081

Closed
shamhub opened this issue May 12, 2018 · 2 comments
Closed

TS2322: Why symbol type is not allowed with enum type? #24081

shamhub opened this issue May 12, 2018 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@shamhub
Copy link

shamhub commented May 12, 2018

Instead of using constant variable declarations,

const directionUp: symbol = Symbol();
const directionDown: symbol = Symbol();
const directionLeft: symbol = Symbol();
const directionRight: symbol = Symbol();

it make more sense to use enum type(shown below):


enum Direction {
    Up = Symbol(),
    Down = Symbol(),
    Left = Symbol(),
    Right = Symbol(),
}

Why TypeScript does not allow using symbol type with enum type?

@shamhub shamhub changed the title Why Symbol is not allowed in enum? TS2322: Why Symbol is not allowed in enum? May 12, 2018
@shamhub shamhub changed the title TS2322: Why Symbol is not allowed in enum? TS2322: Why symbol type is not allowed with enum type? May 12, 2018
@DanielRosenwasser
Copy link
Member

Looks like you want #18408.

@DanielRosenwasser DanielRosenwasser added the Duplicate An existing issue was already created label May 12, 2018
@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants