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

Support extends up to 20 in Mixins function #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ali-master
Copy link

@ali-master ali-master commented Aug 14, 2022

Increase the Number of extends that the Mixins' type supports up to 20, The current is 10.

@ali-master ali-master changed the title feat(Mixins): support extends up to 20 Support extends up to 20 in Mixins function Aug 14, 2022
@tannerntannern
Copy link
Owner

tannerntannern commented Aug 14, 2022

Hi @ali-master, thanks for the contribution! I have a few concerns with the PR in it's current state, but I think we can figure those out and get this feature merged soon. My first concern is formatting: the higher arity overloads have the type parameters so spread out that the code is difficult to navigate and it feels prone to errors that are difficult to spot. However, the error prone nature can't be blamed entirely on the formatting -- with the shear number of overloads and type parameters, it's unavoidable, which leads me to my other concern: these overloads should really be generated automatically rather than hand typed (especially with the extra overloads). The framework for doing this code generation is already more or less in place. It would just require some edits to codegen.js at the root of the repository. It could leverage the replaceInFile function.

I don't want to "erase" your contribution by doing it myself, so I'll give you the option to make this change if you'd like. If you don't care about that and just want the feature, I'm also happy to make this change myself. Let me know what you think.

@Scalahansolo
Copy link

Would it not be possible to just the call signature on this to take an arbitrary number of mixins?

@tannerntannern
Copy link
Owner

Would it not be possible to just the call signature on this to take an arbitrary number of mixins?

I wish it was, but TypeScript's type system isn't powerful enough to handle this kind of type inference for an arbitrary number of inputs. This is a common problem in other languages as well.

There may be a possibility of some recursive type inference enabled by a recent TypeScript release, but I haven't had a chance to look into this yet.

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.

None yet

3 participants