Skip to content

Releases: siyavuyachagi/typesharp

v0.1.1

19 Feb 02:00

Choose a tag to compare

TypeSharp v0.1.1 Release Notes

Released: 2026-02-19
Type: Minor release — new features + bug fixes
npm: npm install @siyavuyachagi/typesharp@0.1.1


What's New

Computed & Block Getter Properties

TypeSharp can now parse all common C# property declaration styles, not just { get; set; }. This release adds full support for:

// Expression-bodied
public string FullName => $"{FirstName} {LastName}";

// Block getter
public string Avatar { get { return User?.Avatar; } }

// Init-only
public string Id { get; init; }

All three are now included in generated TypeScript interfaces.


Dictionary → Record Mapping

C# dictionary types now map correctly to TypeScript Record<K, V>:

public Dictionary<string, int> Scores { get; set; }
public IReadOnlyDictionary<Guid, UserDto> UserMap { get; set; }
scores: Record<string, number>;
userMap: Record<string, UserDto>;

Nested generics like Dictionary<string, List<UserDto>> are also handled correctly, resolving to Record<string, UserDto[]>.


Multi-Project Support

projectFiles now accepts an array, allowing you to scan multiple C# projects in one run:

{
  "projectFiles": [
    "C:/MyApp/Api/Api.csproj",
    "C:/MyApp/Domain/Domain.csproj"
  ]
}

Automatic Import Generation

When using singleOutputFile: false, TypeSharp now automatically generates import type statements between output files. If UserDto in post-dto.ts references UserDto from user-dto.ts, the import is added for you — no manual wiring needed.


Generic Inheritance

Generic base class relationships are now fully preserved:

public class PagedApiResponse<T> : ApiResponse<T> { ... }
export interface PagedApiResponse<T> extends ApiResponse<T> { ... }

Advanced Naming Convention Config

namingConvention now supports separate conventions for directories and files:

{
  "namingConvention": {
    "dir": "kebab",
    "file": "camel"
  }
}

Output Directory Cleanup

The output directory is now automatically cleaned before each generation run, preventing stale or renamed files from lingering between runs.


New Type Mappings

C# Type TypeScript Type
IFormFile File
IFormFileCollection File[]
FormFile File
FileStream Blob
MemoryStream Blob
Stream Blob

Bug Fixes

  • Fixed duplicate properties in generated interfaces when a class contained a mix of { get; set; } and computed properties. The previous regex-based approach caused double-matching; properties are now parsed in three separate, non-overlapping passes.
  • Fixed type bleeding where overly permissive regex patterns would match across multiple properties and produce incorrect type names.
  • Fixed nested generic type resolution for Dictionary<K, V> where V itself was a generic collection.

Upgrading from 0.1.0

No breaking changes. Update your dependency:

npm install @siyavuyachagi/typesharp@0.1.1 --save-dev

If you were using projectFiles as a single string, it continues to work unchanged. The new array format is additive.


Contributors

v0.1.0

19 Dec 07:11

Choose a tag to compare

v0.1.0 — Initial public release (2025-12-19)

TypeSharp is a direct C# → TypeScript generator (NOT OpenAPI-based). It scans your ASP.NET Core project for classes/enums decorated with a chosen attribute (default [TypeSharp]) and generates TypeScript interfaces/enums while preserving generics, inheritance, file grouping, and naming conventions.

Highlights

  • Direct parsing of C# models (no OpenAPI/Swagger required)
  • Attribute targeting to select models
  • Generics, inheritance, and collection support preserved
  • CLI scaffolding, TypeScript definitions, runtime helpers, docs, and CI

For the full changelog, see CHANGELOG.md in the repository.

Installation and usage
See the README: https://github.com/siyavuyachagi/typesharp#readme

Contributors