-
Notifications
You must be signed in to change notification settings - Fork 21
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
Make types dumber #14
Comments
FWIW, when the types work though, it's magical. |
Yeahhhh I know, this is why I tried so hard to get it working. But I actually started getting max call stack errors running tests due to the inference, not the actual code. And when it doesn't work, it's really hard to override since many functions take multiple generic arguments. I'm not really sure the best approach to move forward, and it's not particularly enjoyable work to do. Also, to make tooltips more readable I threw in ts-toolbelt as a dependency (which is the real reason for the call stack overflows I think). For future reference, if you're failing to get types to work and the tidy function is yelling at you, you can nuke it with by casting the function itself as any: e.g. |
Another issue with the complex types is it increases the barrier for contribution. I know JS devs that would happily add a function here or there to the repo, but the types stop them :( |
Could be worth setting up test types with tsd: https://github.com/SamVerschueren/tsd |
Actually, losing types and casting is an antipattern when using typescript. I was actually going to propose that some functions like desc and asc used keyof instead of simply Key. like:
instead of:
|
It gets very annoying when the type inference is wrong. Perhaps we can mitigate this by stopping trying to be clever with keyof and other crazy generics and just make whatever comes out of tidy be opaque. At the end of tidy flows, users can cast their outputs to their expected types. Currently you have to fight the type system and guess where to override things and it is just crazy.
The text was updated successfully, but these errors were encountered: