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

Add includeTypedArrays option to generateTypeScript #128

Merged
merged 4 commits into from
Sep 27, 2023

Conversation

jtbandes
Copy link
Member

@jtbandes jtbandes commented Sep 22, 2023

Public-Facing Changes

Added an includeTypedArrays option to generateTypeScript to allow generating type definitions that include TypedArrays in addition to plain number[] arrays.

Description

Relates FG-4976
See also https://github.com/foxglove/studio/pull/6890

@jtbandes jtbandes marked this pull request as ready for review September 22, 2023 01:35
@@ -26,7 +41,15 @@ export const DURATION_TS = `export type Duration = {
};
`;

export function generateTypeScript(schema: FoxgloveSchema): string {
export type GenerateTypeScriptOptions = {
/** Include TypedArray types on numeric array fields, e.g. `number[] | Uint32Array` */
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth mentioning when it might be important to use this?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated comment

@jtbandes jtbandes merged commit 3009ac7 into main Sep 27, 2023
9 checks passed
@jtbandes jtbandes deleted the jacob/ts-typed-arrays branch September 27, 2023 18:33
pezy pushed a commit to pezy/studio that referenced this pull request Oct 25, 2023
…#6890)

**User-Facing Changes**
Fixed a type incompatibility issue with User Scripts that import from
@foxglove/schemas.

**Description**
Fixes #6821 
Fixes FG-4976
Depends on foxglove/schemas#128
Also updated JSON message datatype extraction to treat integer arrays as
`Uint32Array` rather than `Float64Array`; this fixed a similar issue as
#6821 with an example json-based mcap I had lying around.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants