TypeSharp handles both nullable value types (int?) and nullable reference types (string?) — mapping both to T | null in TypeScript.
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; } }
export interface ProfileDto { name: string; bio: string | null; age: number; score: number | null; deletedAt: string | null; }
<Nullable>enable</Nullable> in your .csproj for reference type nullability to be detected. Nullable<T> (long form) is also handled identically to T?.