1 Commits
0.0.1 ... 0.0.2

Author SHA1 Message Date
f4b32f650c Make optional types better optional in typescript 2025-05-28 13:20:03 +02:00

View File

@ -476,9 +476,12 @@ impl<F: Flavour> Compile for TypeScriptCompiler<F> {
for field in definition.fields.iter() { for field in definition.fields.iter() {
let typ = Self::type_to_typescript_ext(&field.typ); let typ = Self::type_to_typescript_ext(&field.typ);
let opt = if field.typ.is_optional() { "?" } else { "" };
f.a1(format!( f.a1(format!(
"public {}: {};", "public {}{}: {};",
Self::fix_keyword_name(&field.name), Self::fix_keyword_name(&field.name),
opt,
typ typ
)); ));
} }