-
-
Notifications
You must be signed in to change notification settings - Fork 669
feat: make result of StaticArray#slice and StaticArray#concat as instance generics. Deprecate static methods #2404
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
Conversation
Iirc the idea here is that |
The main problem with |
I guess the same would apply to other static methods as well then, and without inference of return types seems tricky. Hmm. Sure it wouldn't be better to defer until we can update all of this according to your suggestion? |
I think we can move towards this iteratively. These changes don't break anything. And then we can remove all static methods that duplicate instance methods but only with a different return type. I just don't know how soon we will have inferring returned generic types |
Btw I tried do the same for
For new signature: concat<U extends ArrayLike<T> = Array<T>>(other: U): U {
....
} UPD: |
StaticArray.slice
/StaticArray.concat
are quite not standard. Also, many users more expectStaticArray
as returning type insteadArray
forslice
method. With this change, we preserve old behavior, so it's non breakable change.Open question:
What if change default return type from
Array
toStaticArray
and removeStaticArray.slice
at all? This will be breaking change than.