Comments (5)
sounds like an issue in your frontend code, what is the value of projectInfo.value
in your frontend code?
it should look something like this:
{
name: "Project name",
template: "rustBinary"
}
if it doesn't look like this, then your frontend is the issue, otherwise please provide a minimal repro and ping me
from tauri.
sounds like an issue in your frontend code, what is the value of
projectInfo.value
in your frontend code?
it should look something like this:{ name: "Project name", template: "rustBinary" }if it doesn't look like this, then your frontend is the issue, otherwise please provide a minimal repro and ping me
It's something like this:
enum Template {
RustBinary,
RustLibrary,
...
}
const projectInfo: ComputedRef<ProjectInfo> = computed(() => {
const template =
Template[projectTemplateInput.value as keyof typeof Template];
return {
name: projectName.value, // string
template, // Template
});
from tauri.
Typescript enums are not 1:1 equivalent of Rust enums, so you have to make sure they are equal, there is two ways you can do this:
- use
repr(u16)
but will require usage ofserde_repr
crate so serialization/deserialization could work properly, see https://serde.rs/enum-number.html - change the typescript enum definition to match the serialization of rust enum, so it would look like this:
enum Template { RustBinary = "rustBinary", RustLibrary = "rustLibrary", ... }
from tauri.
Typescript enums are not 1:1 equivalent of Rust enums, so you have to make sure they are equal, there is two ways you can do this:
- use
repr(u16)
but will require usage ofserde_repr
crate so serialization/deserialization could work properly, see https://serde.rs/enum-number.html- change the typescript enum definition to match the serialization of rust enum, so it would look like this:
enum Template { RustBinary = "rustBinary", RustLibrary = "rustLibrary", ... }
I have fixed it through the first way.
But I think this is really confusing for tauri user, maybe Tauri should provide a macro like #[derive(tauri::CommandArg)]
to do these works(derive Serialize_repr, Deserialize_repr or Serialize, Deserialize traits, and add #[serde(rename_all = "camelCase")]
) on-demand?
from tauri.
I think you're looking for https://github.com/oscartbeaumont/tauri-specta which generates typescript definitions for your based on your commands .
from tauri.
Related Issues (20)
- [bug] v2: Windows' Task View kills Tauri
- [bug] Image is not lazy loaded when having lazy in img loading attribute
- [bug] Custom menu items donβt work after updating app menu
- Electron provides a `new-window` event in the main thread, but TAURI does not.
- [bug] Cancelling drag & drop with the escape key does not fire cancellation
- [bug] multiwebview example stops resizing
- [bug] `tauri build` not supporting nightly -Z bindeps HOT 4
- [bug] animation freeze on the app but not the browser HOT 2
- [feat] Windows Thumbnail Toolbar (like media control buttons)
- [bug] error: linking with cc failed: exit status: 1 on fedora
- [feat] automatically create tasks.json HOT 2
- [bug] [v2] undo and redo shortcuts don't work in popular editor on MacOS HOT 1
- [bug] it is too easy to have a js plugin lib on one version and rust on another HOT 1
- [bug] [v2] trayIcon set_visible(true) method is not working HOT 3
- [feat] Is there a way to allow window.open() on the front end? HOT 1
- [feat] Support transparent webviews on mobile HOT 2
- [bug] `tauri dev` cannot find binary path when `default-run` changed
- [bug] Setting windows manifest returns "duplicate resource". HOT 1
- [bug] Inconsistent render order HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tauri.