GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - skbkontur/TypeScript.ContractGenerator: A tool that can generate TypeScript types from C# classes

BranchesTags
Open more actions menu

Latest commit

 

History

367 Commits
367 Commits

Folders and files

NameName
Last commit message
Last commit date
.config
.config
 
 
.github/workflows
.github/workflows
 
 
AspNetCoreExample.Api
AspNetCoreExample.Api
 
 
AspNetCoreExample.Generator
AspNetCoreExample.Generator
 
 
TypeScript.ContractGenerator.Cli
TypeScript.ContractGenerator.Cli
 
 
TypeScript.ContractGenerator.Roslyn
TypeScript.ContractGenerator.Roslyn
 
 
TypeScript.ContractGenerator.Tests
TypeScript.ContractGenerator.Tests
 
 
TypeScript.ContractGenerator
TypeScript.ContractGenerator
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.rebuild-nuget-package.cmd
.rebuild-nuget-package.cmd
 
 
.rebuild.cmd
.rebuild.cmd
 
 
.run-all-tests.cmd
.run-all-tests.cmd
 
 
CHANGELOG.md
CHANGELOG.md
 
 
Common.DotSettings
Common.DotSettings
 
 
Directory.Build.props
Directory.Build.props
 
 
Directory.Build.targets
Directory.Build.targets
 
 
LICENSE
LICENSE
 
 
MIGRATION.md
MIGRATION.md
 
 
README.md
README.md
 
 
TypeScript.ContractGenerator.sln
TypeScript.ContractGenerator.sln
 
 
TypeScript.ContractGenerator.sln.DotSettings
TypeScript.ContractGenerator.sln.DotSettings
 
 
global.json
global.json
 
 
nuget.config
nuget.config
 
 
version.json
version.json
 
 

Repository files navigation

TypeScript.ContractGenerator

A tool that can generate TypeScript types from C# classes

Build Status
TypeScript.ContractGenerator NuGet Status
TypeScript.ContractGenerator.Roslyn NuGet Status
TypeScript.ContractGenerator.Cli NuGet Status
Build Build status

Release Notes

See CHANGELOG.

How to Use

See https://github.com/skbkontur/TypeScript.ContractGenerator/wiki#how-to-use

See Quick Start for more detailed guide

Generation options

See https://github.com/skbkontur/TypeScript.ContractGenerator/wiki/Generation-Options

Attributes

There is ContractGeneratorIgnore attribute that can be applied to properties and makes generator skip current property.

Roslyn usage

To use Roslyn you should get a Compilation object of your project. It can be done with helper method AdhocProject.GetCompilation(string[] directories, string[] assemblies). You can then get customization info from this compilation by calling extension method compilation.GetCustomization() and call TypeScriptGenerator with this customization:

var (customTypeGenerator, typesProvider) = AdhocProject.GetCompilation(directories, assemblies).GetCustomization();
var typeGenerator = new TypeScriptGenerator(options, customTypeGenerator, typesProvider);
typeGenerator.GenerateFiles(outputDirectory);

dotnet tool usage

Install tool with command:

dotnet tool install -g SkbKontur.TypeScript.ContractGenerator.Cli

Use tool with command:

dotnet ts-gen --assembly ./Api/bin/Api.dll --outputDir ./src/Api

dotnet tool also supports Roslyn:

dotnet ts-gen --directory ./Api;./Core --assembly ./External/Dependency.dll --outputDir ./src/Api

About

A tool that can generate TypeScript types from C# classes

Topics

code-generationcode-generatorcsharproslyntypescript

Resources

Readme
MIT license
Activity
Custom properties

Stars

61 stars

Watchers

19 watching

Forks

22 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.