这是indexloc提供的服务,不要输入任何密码
Skip to content

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,Command not found. If this idea is OK,plz 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.

1 participant