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

view string autocomplete. #578

Open
FractalHQ opened this issue Oct 25, 2023 · 2 comments
Open

view string autocomplete. #578

FractalHQ opened this issue Oct 25, 2023 · 2 comments

Comments

@FractalHQ
Copy link

Right now, the view option is typed as string, which provides no autocomplete:

folder.addBlade({
  view: '', // no autocomplete
})

I think a union of string literals would be awesome to have here. This would make it easy to see what the available views are without having to surf the docs every time.

If it was instead typed like this:

type View = 'color' | 'list' | 'graph' | ...etc | ({} & string)

The ({} & string) would allow any string value, but the type would preserve the intellisense for autocomplete!

I think this could also be used to infer the type of the binding returned using conditional types internally... but that is another issue altogether 😇

@cocopon
Copy link
Owner

cocopon commented Oct 28, 2023

Interesting. Do you know how it works? It looks a bit cryptic and I still can't understand why it works as intended.

@FractalHQ
Copy link
Author

Yea it's a weird one!

You can read more about it in these stack overflow posts:

https://stackoverflow.com/a/61048124
https://stackoverflow.com/a/75265010

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

2 participants