From 456ec72ddab9b75913294997bf456b3b9304243a Mon Sep 17 00:00:00 2001 From: Moritz Bischof Date: Mon, 29 Jan 2024 20:19:06 +0100 Subject: [PATCH] adjust documentation --- ts-rs/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts-rs/src/lib.rs b/ts-rs/src/lib.rs index a7d4a8912..17b100520 100644 --- a/ts-rs/src/lib.rs +++ b/ts-rs/src/lib.rs @@ -227,7 +227,10 @@ mod export; /// Skip this field /// /// - `#[ts(optional)]`: -/// Indicates the field may be omitted from the serialized struct +/// May be applied on a struct field of type `Option`. +/// By default, such a field would turn into `t: T | null`. +/// If `#[ts(optional)]` is present, `t?: T` is generated instead. +/// If `#[ts(optional = nullable)]` is present, `t?: T | null` is generated. /// /// - `#[ts(flatten)]`: /// Flatten this field (only works if the field is a struct)