Skip to content

Conversation

ThomasdenH
Copy link
Contributor

Fixes #17962.

This PR changes the constructor definitions of the typed arrays to allow for valid code as described in #17962.

@msftclas
Copy link

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@ThomasdenH
Copy link
Contributor Author

What is the procedure for merging pull requests?

@DanielRosenwasser
Copy link
Member

Generally it's better to merge overloads to use union types, but I'm actually not super into doing so when the first parameter has such a drastically different use. I'll let others weigh in.

@@ -1743,9 +1743,8 @@ interface Int8Array {
}
interface Int8ArrayConstructor {
readonly prototype: Int8Array;
new(length: number): Int8Array;
new(array: ArrayLike<number>): Int8Array;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please keep the first overload there, and change the second to be new(arrayOrBuffer: ArrayLike<number> | ArrayBufferLike): Int8Array;
this way it is clearer that it can either be called with a number, or with ArrayLike/ArrayBufferLike

@ThomasdenH
Copy link
Contributor Author

I created an updated PR: #18367.

@ThomasdenH ThomasdenH closed this Sep 10, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants