-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[TS/JS] Add support for creating vectors from typed arrays #6446
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
Conversation
This commit add support for creating vectors directly from in-memory JavaScript typed arrays (Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array and Float64Array). There was already support for reading directly to typed arrays. This brings the counterpart for writing. This commit also removes the invalid Uint8Array overloads. These overloads were invalid as they enabled a TypeScript user to pass a Uint8Array to the generated methods which were in turn iterating on the array content as if they were normal numbers. Summary of changes: * add support for typed array factory methods in builder.ts * add corresponding support in idl_gen_ts.cpp * remove invalid Uint8Array overloads in idl_gen_ts.cpp
|
@krojew Would you mind helping me make my two PRs pass the CIs ? I think the problems come from the generated files. |
|
Sorry for not responding, but I have almost no free time at the moment. |
|
This pull request is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days. |
|
I will update this PR soon. |
|
@ptitjes Any plans to continue this? Otherwise I will mark it closed. |
|
Please reopen if you would like to continue this. |

This commit add support for creating vectors directly from in-memory JavaScript typed arrays (
Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32ArrayandFloat64Array).There was already support for reading directly to typed arrays. This brings the counterpart for writing.
This commit also removes the invalid
Uint8Arrayoverloads. These overloads were invalid as they enabled a TypeScript user to pass aUint8Arrayto the generated methods which were in turn iterating on the array content as if they were normal numbers.Summary of changes:
builder.tsidl_gen_ts.cppUint8Arrayoverloads inidl_gen_ts.cppThis PR is based on #6445 which fixed a code gen bug after #6420.