TypeSharp handles both nullable value types (int?) and nullable reference types (string?) — mapping both to T | null in TypeScript.
[TypeSharp] public class ProfileDto { public string Name { get; set; } // non-nullable public string? Bio { get; set; } // nullable reference public int Age { get; set; } // non-nullable public int? Score { get; set; } // nullable value public DateTime? DeletedAt { get; set; } }
Nullable<T>Nullable<T> is handled identically to T? — both map to T | null.
[TypeSharp] public class ExampleDto { public Nullable<int> Score { get; set; } // long form public int? Rank { get; set; } // short form }