GenItEasy 0.0.1
Suggested Alternatives
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package GenItEasy --version 0.0.1
NuGet\Install-Package GenItEasy -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GenItEasy" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GenItEasy" Version="0.0.1" />
<PackageReference Include="GenItEasy" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GenItEasy --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: GenItEasy, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package GenItEasy@0.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GenItEasy&version=0.0.1
#tool nuget:?package=GenItEasy&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
GenItEasy
A .NET library and CLI tool for generating TypeScript type definitions from C# assemblies using TypeLitePlus.
Installation
As a Library
dotnet add package GenItEasy
As a CLI Tool
dotnet tool install GenItEasy.CLI
Usage
Library Usage
using GenItEasy;
using GenItEasy.Utilities;
// Load config from JSON
var config = ConfigLoader.LoadConfig("typescriptgenconfig.json");
config.BaseDirectory = Path.Combine(AppContext.BaseDirectory); // Important, otherwise output generated files may resolve in a wrong location
var generator = new TypeScriptGenerator(config);
generator.Generate();
With logging:
using Microsoft.Extensions.Logging;
var logger = loggerFactory.CreateLogger<TypeScriptGenerator>();
var generator = new TypeScriptGenerator(config, logger);
generator.Generate();
CLI Usage
# Run with config file
genit typescriptgenconfig.json
# Specify assembly base directory (where the DLLs are)
genit typescriptgenconfig.json --base-directory bin/Debug/net9.0
MSBuild Integration
Add to your consumer project's .csproj:
<Target Name="GenerateTypeScript" AfterTargets="Build">
<Exec Command="genit typescriptgenconfig.json --base-directory $(TargetDir)" />
</Target>
This runs TypeScript generation after every build, resolving assemblies from the build output directory.
Configuration
Create a typescriptgenconfig.json file:
{
"assemblyName": "MyApp.Models",
"outputPath": "../ClientApp/src/types",
"outputFileName": "models.gen.ts",
"namespaces": [
{
"namespace": "MyApp.Models.Dtos",
"includeNested": false,
"excludeTypes": ["Internal", "Base"]
}
]
}
Configuration Options
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
assemblyName |
string | Yes | - | Assembly name or DLL filename to load |
outputPath |
string | Yes | - | Output directory (relative to working directory, or absolute) |
outputFileName |
string | Yes | "models.gen.ts" |
Generated TypeScript filename |
baseDirectory |
string | No | null |
Directory to find the assembly DLL (overridden by --base-directory CLI flag) |
includeStaticClasses |
bool | No | false |
Include static classes in output |
namespaces |
array | Yes | - | List of namespace configurations |
Namespace Configuration
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
namespace |
string | Yes | - | Fully qualified namespace to scan |
includeTypes |
array | No | null |
Whitelist patterns (prefix/suffix/exact match) |
excludeTypes |
array | No | null |
Blacklist patterns |
includeGenericTypes |
array | No | null |
Whitelist for generic type base names |
excludeGenericTypes |
array | No | null |
Blacklist for generic type base names |
includeNested |
bool | No | false |
Include types from child namespaces |
Type Mappings
| C# Type | TypeScript Type |
|---|---|
Guid |
string |
DateTime |
Date |
int, long, decimal, double, float |
number |
bool |
boolean |
string |
string |
List<T>, T[] |
T[] |
Dictionary<string, T> |
{ [key: string]: T } |
Nullable types (T?) |
T \| null |
| Classes | interface (with I prefix) |
| Enums | enum (no prefix) |
Project Structure
GenItEasy/
├── GenItEasy.csproj # Library (NuGet package)
├── TypeScriptGenerator.cs # Main orchestrator
├── Configuration/ # Config models
├── Discovery/ # Assembly loading & type discovery
├── Filters/ # Type include/exclude filtering
├── Formatters/ # TypeScript formatting (types, names, visibility)
├── Processing/ # Post-processing cleanup
├── Utilities/ # ConfigLoader, PathResolver
└── GenItEasy.CLI/
├── GenItEasy.CLI.csproj # CLI tool (dotnet tool)
└── Program.cs # CLI entry point
Dependencies
- TypeLitePlus 2.1.0 — TypeScript generation engine
- Microsoft.Extensions.Logging.Abstractions 9.0.0 — Optional logging interface
- .NET 9.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.0)
- TypeLitePlus (>= 2.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|