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

Many types are 1-tuples where they should be arrays #28

Closed
valerian opened this issue Jul 6, 2016 · 0 comments · Fixed by #29
Closed

Many types are 1-tuples where they should be arrays #28

valerian opened this issue Jul 6, 2016 · 0 comments · Fixed by #29

Comments

@valerian
Copy link
Collaborator

valerian commented Jul 6, 2016

Throughout the declarations there are many occurrences of 1-tuples where it should have been an array.

[string] is a 1-tuple containing 1 element of type string.

string[] is an array of string elements.

And what is even more confusing is that tuples are bugged in TypeScript, allowing to use more elements than defined: microsoft/TypeScript#6229

An example of this issue in the present declarations:

RoomPosition.findClosestByRange<T>(objects: [T|RoomPosition], opts?: {filter: any|string }): T;

Which should actually be:

RoomPosition.findClosestByRange<T>(objects: T[]|RoomPosition[], opts?: {filter: any|string }): T;

I will try to fix all of them and do a pull request.

@valerian valerian changed the title Many issues with argument types declared as 1-tuples instead of arrays Many argument are 1-tuples where they should be arrays Jul 6, 2016
@valerian valerian changed the title Many argument are 1-tuples where they should be arrays Many types are 1-tuples where they should be arrays Jul 6, 2016
@NhanHo NhanHo closed this as completed in #29 Jul 6, 2016
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 a pull request may close this issue.

1 participant