You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried both tagged or untagged enum in struct, not working.
Code
Tagged:
use serde::Serialize;use ts_rs::TS;#[derive(Serialize,TS)]#[ts(export)]structFoo{#[serde(flatten)]baz:Bar,}#[derive(Serialize,TS)]#[serde(tag = "tag")]#[ts(export)]enumBar{
_Baz {a:i32},}
Untagged:
use serde::Serialize;use ts_rs::TS;#[derive(Serialize,TS)]#[ts(export)]structFoo{#[serde(flatten)]baz:Bar,}#[derive(Serialize,TS)]#[serde(untagged)]#[ts(export)]enumBar{
_Baz,}
Error
---- ts::export_bindings_foo stdout ----
thread 'ts::export_bindings_foo' panicked at 'Bar cannot be flattened', [:REDACTED:]/.cargo/registry/src/github.com-1ecc6299db9ec823/ts-rs-6.1.2/src/lib.rs:243:9
Info
version of ts-rs: 6.1.2
version of rustc: rustc 1.60.0 (7737e0b5c 2022-04-04)
The text was updated successfully, but these errors were encountered:
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.importtype{BazStruct}from"./BazStruct";importtype{QuxStruct}from"./QuxStruct";exporttypeBar=BazStruct|QuxStruct;
and it feels like the generated TS for Foo could just be
I have tried both tagged or untagged enum in struct, not working.
Code
Tagged:
Untagged:
Error
Info
version of
ts-rs
:6.1.2
version of
rustc
:rustc 1.60.0 (7737e0b5c 2022-04-04)
The text was updated successfully, but these errors were encountered: