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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add enum value to union and some utils #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

4xii
Copy link

@4xii 4xii commented Aug 2, 2022

馃巵 Pull Request

  • [鉁匽 Used a clear / meaningful title for this pull request
  • [鉁匽 Tested the changes in your own code (on your projects)
  • [鉁匽 Added / Edited tests to reflect changes (tests folder)
  • [鉁匽 Have read the Contributing part of the Readme
  • [鉁匽 Passed npm test

Why have you made changes?

Sometimes we need to change the enumerated value into a union type.
stackoverflow:
https://stackoverflow.com/questions/52393730/typescript-string-literal-union-type-from-enum

enum StrValueEnum {
  T1 = "1",
  T2 = "2",
  T3 = "3",
}


enum NumValueEnum {
  T1 = 1,
  T2 = 2,
  T3 = 3,
}

`${StrValueEnum}` // Type is "1" | "2" | "3",that is right
`${NumValueEnum}` // Type is "1" | "2" | "3",that is wrong

but sorry about I don't know how to fix lint锛孋ommand not found. If this idea is OK锛宲lz tell me how to fix.

@4xii 4xii requested a review from millsp as a code owner August 2, 2022 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant