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

Type string union #7

Open
CavalcanteLeo opened this issue Feb 17, 2024 · 0 comments
Open

Type string union #7

CavalcanteLeo opened this issue Feb 17, 2024 · 0 comments

Comments

@CavalcanteLeo
Copy link

CavalcanteLeo commented Feb 17, 2024

Would be great if it also worked with type union...

type IconName =
  // image(../../assets/icons/icon1.svg)
  | 'icon1' 
  // image(../../assets/icons/icon2.svg)
  | 'icon2'
  // image(../../assets/icons/icon3.svg)
  | 'icon3'
  // image(../../assets/icons/icon4.svg)
  | 'icon4'

Then I could use something like:

const icon: IconName = 'icon2' // <-- here it could show on autocomplete or while hovering 
Screenshot 2024-02-17 at 10 15 35 PM
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

No branches or pull requests

1 participant