Use Serde attributes for TypeScript compatibility
mainWith the serde-compat feature (enabled by default), ts-rs respects many serde attributes to ensure your TypeScript types match your serialized data.
Supported attributes:
rename,rename-all,rename-all-fieldstag,content,untagged(for enums)skip,skip_serializing,skip_serializing_if,flatten,default
Important Notes:
skip_serializingandskip_serializing_ifonly work correctly if used with#[serde(default)]to ensure the generated type is valid for both serialization and deserialization.skip_deserializingis ignored.- If you want to exclude a field from the TypeScript type but cannot use
#[serde(skip)], use#[ts(skip)]instead.