Skip to content

Fix TypedArray.wrap definition #939

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

Merged
merged 8 commits into from
Nov 16, 2019
Merged

Fix TypedArray.wrap definition #939

merged 8 commits into from
Nov 16, 2019

Conversation

MaxGraey
Copy link
Member

@MaxGraey MaxGraey commented Nov 7, 2019

Relate to #938

@dcodeIO
Copy link
Member

dcodeIO commented Nov 7, 2019

Considering that the implementation isn't generic, wouldn't it be straight-forward to model the declaration exactly like that by adding one .wrap to each subclass with a concrete return type? Would otherwise imagine that someone could try to use it as a generic function with unexpected results.

@MaxGraey
Copy link
Member Author

MaxGraey commented Nov 7, 2019

I simplified this. I guess this completely solved issue

@MaxGraey
Copy link
Member Author

MaxGraey commented Nov 7, 2019

Considering that the implementation isn't generic, wouldn't it be straight-forward to model the declaration exactly like that by adding one .wrap to each subclass with a concrete return type?

What about this?

static wrap<_T = TypedArray<number>>(this: Constructor<_T>, ...): _T;

@MaxGraey MaxGraey requested a review from dcodeIO November 16, 2019 14:10
@dcodeIO dcodeIO merged commit b2bb264 into AssemblyScript:master Nov 16, 2019
@dcodeIO
Copy link
Member

dcodeIO commented Nov 16, 2019

That's ideal, thanks! :)

@MaxGraey MaxGraey deleted the fix-typedarray-wrap-def branch November 16, 2019 14:17
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.

2 participants