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

Allow emitting arrays as TS tuples #137

Closed
akx opened this issue Jan 12, 2023 · 0 comments · Fixed by #209
Closed

Allow emitting arrays as TS tuples #137

akx opened this issue Jan 12, 2023 · 0 comments · Fixed by #209

Comments

@akx
Copy link

akx commented Jan 12, 2023

pub(crate) struct Scene {
    color: [f32; 4],
}

currently becomes an array of uncertain length,

export interface Scene { 
  color: Array<number>;
}

It would be useful to be able to mark this e.g.

pub(crate) struct Scene {
    #[ts(tuple)]
    color: [f32; 4],
}

to emit it as

export interface Scene { 
  color: [number, number, number, number];
}

I tried my hand at implementing this myself, but got lost in macros...

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