TypeSharp resolves class hierarchies and maps them to TypeScript extends. Base classes are emitted as separate interface files and referenced by name.
[TypeSharp] public class BaseEntity { public int Id { get; set; } public DateTime CreatedAt { get; set; } } [TypeSharp] public class UserDto : BaseEntity { public string Name { get; set; } public string? Email { get; set; } }
Full inheritance chains are resolved — each level gets its own interface file.
[TypeSharp] public class Entity { public int Id { get; set; } } [TypeSharp] public class AuditableEntity : Entity { public DateTime CreatedAt { get; set; } public DateTime UpdatedAt { get; set; } } [TypeSharp] public class UserDto : AuditableEntity { public string Name { get; set; } public string Email { get; set; } }
Any base type matching the C# interface convention (I + uppercase letter) is automatically stripped from the inheritance chain.
[TypeSharp] public class PaymentResult : BaseResult, IActionResult, IDisposable { public bool Paid { get; set; } }
IEntity, IDisposable) are automatically filtered — only class inheritance is mapped.