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
[misc] Specify length of toArray return type #5766
Conversation
toArray will always return an array with seven numbers. This change is necessary to be able to do `new Date(...m.toArray())`. As just `number[]`, it complains with `Expected 0-7 arguments, but got 0 or more.`.
Interesting. Is this TS 1.x compatible? Otherwise, you can update the ts3.1 typings. |
Tuples were added in 1.3, so not quite. |
@mongoose700 Thanks for the update. Could you also add a test https://github.com/moment/moment/blob/develop/ts3.1-typing-tests/moment-tests.ts and I'll merge it |
I wanted to add a test that invoked |
Thanks! |
This reverts commit 52019f1.
toArray will always return an array with seven numbers. This change is necessary to be able to do
new Date(...m.toArray())
. As justnumber[]
, it complains withExpected 0-7 arguments, but got 0 or more.
.