Skip to content

Conversation

@mongoose700
Copy link
Contributor

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..

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.`.
@mongoose700 mongoose700 changed the title Specify length of toArray return value [misc] Specify length of toArray return value Oct 28, 2020
@coveralls
Copy link

coveralls commented Oct 28, 2020

Coverage Status

Coverage increased (+0.03%) to 88.525% when pulling 31bee3f on mongoose700:patch-1 into 0dcaaa6 on moment:develop.

@marwahaha
Copy link
Member

Interesting.

Is this TS 1.x compatible?

Otherwise, you can update the ts3.1 typings.

@mongoose700
Copy link
Contributor Author

Tuples were added in 1.3, so not quite.

@marwahaha
Copy link
Member

@mongoose700
Copy link
Contributor Author

I wanted to add a test that invoked new Date(...moment().toArray()), but the spread syntax wasn't available, and apply isn't type-safe.

@marwahaha
Copy link
Member

Thanks!

@Dustin4444
Copy link

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..

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.

5 participants