Closed StevenJPx2 closed 10 months ago
Thanks this sounds great! I'll take a look at it as soon as I have a chance!
Any updates?
Any updates?
@StevenJPx2 Sorry! have been busy didn't have a chance to review this.
@StevenJPx2 This is a nice improvement. The suggestions for the types option look much better!
Regarding your suggestion (explicitly defining all the possible values using an object), I'll leave it up to you. I think your current solution works well though.
I'm going to merge this, feel free to submit another PR if you want to make any additional changes.
Again, apologies for the slow response time
No problem! Thanks for merging! I looked into the object style of doing it; thing is, if we want to enforce the user to only use the object, we probably need to brand the type, which makes it more complex. Haven't looked it more, but if I think it's feasible, I'll put in another pull request like you mentioned.
Right now, we have a naive combination for the three splitting options which makes it quite difficult to see what you want (repetitions, mainly). Adding a custom type to create true combinations to keep the suggestions nice, accurate and concise.
Before:
After:
I also experimented with tuple combinations, but TypeScript seems to flatten it down to just array element suggestions and stops suggesting combos after the third element. But it doesn't stop you from defining a fourth element, which is not what you want.
Another thing to note, I've changed
TypesValue
from being a union to a tuple, just to keep the typing as simple as possible. The first commit actually has a version where it converts the union to a tuple to do the combination, but it seemed unnecessary and too much for something simple, so I changed it instead.Suggestion:
Maybe to make it stricter and allow JS interop, we can create an object that stores the values of the different combos.
This would limit the number of user errors if you limit them to only these options.