Genrate typescript types from slint ui files using tree sitter #5829
Answered
by
ogoffart
sigmaSd
asked this question in
Show and tell
-
https://github.com/sigmaSd/slintgen Exampleui.slint struct CPUData {
number: int,
active: bool,
}
export component Window inherits Window {
title: "BurnCPU";
in-out property <[CPUData]> cpu-data: [];
in property <int> active-cpus: 0;
callback toggleCPU(int, bool) -> bool; $ slintgen ui.slint > ui.ts ui.ts export interface CPUData {
number: number;
active: boolean;
}
export interface Window {
title: any;
cpu_data: CPUData[];
active_cpus: number;
toggleCPU: (arg0: number, arg1: boolean) => boolean;
run: () => Promise<void>;
} |
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
Aug 14, 2024
Replies: 2 comments 2 replies
-
I also made a deno port https://github.com/sigmaSd/slintgen/tree/master/deno using tree sitter wasm bindings, it can simply run like this
|
Beta Was this translation helpful? Give feedback.
1 reply
-
This is great! Thanks for sharing. This is something we would also like to have built in into Slint itself at some point. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sigmaSd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is great! Thanks for sharing.
This is something we would also like to have built in into Slint itself at some point.
(It should probably be built in in the Slint compiler rather then using the tree-sitter though)