clr2ts 0.1.9

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global clr2ts --version 0.1.9                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local clr2ts --version 0.1.9                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=clr2ts&version=0.1.9                
nuke :add-package clr2ts --version 0.1.9                

clr2ts

Build Status Build status GitHub Nuget (with prereleases)

Transpiler that takes CLR assemblies and outputs corresponding typescript definitions.

Note: Under development

Please note that this tool is still in an early phase of development and missing many important features. There is already a version available on nuget.org that can be installed and used for very simple examples. Future changes should only affect the configuration file, so that you can update to a better version later and just change that file accordingly.

Installation

Get clr2ts by installing it as a dotnet tool from nuget.org.

dotnet tool install -g clr2ts

More information about installing dotnet tools can be found here.

Usage

Run clr2ts by calling the dotnet tool with the configuration file you would like to use.

clr2ts your.config.json

If you call clr2ts without specifying a configuration file, it will automatically look for one in the current working directory and its parent directories using the search pattern *clr2ts.json. If you use relative paths in your configuration, they are always relative to the configuration file.

Configuration

A configuration file may look like this:

{
    "input": { 
        "assemblyFiles": [
            "./Path/To/Your/Assembly.dll"
        ],
        "typeFilters": [
            // Define multiple filters for OR-semantics.
            {
                // Multiple values in a single filter for AND-semantics.
                "hasAttribute": ["AttributeName"],
                "subTypeOf": "BaseType",
                "namespace": "Namespace.SubNamespace"
            }
        ]
    },
    "output": {
        "bundledFile": "./Path/To/Your/TypeScriptCodeBase/bundle.ts",
        "files": {
            "directory": "./Path/To/Your/TypeScriptCodeBase/directory",
            "mimicNamespacesWithSubdirectories": true
        }
    }
}

Future plans

You can find some of the ideas for future releases in the github projects of this repository as well as in the draft for a more complex configuration file located under docs in the source code. Those plans include better translation features (like support of generics and collection types or converting to camelCase naming conventions) and better handling of clr2ts (logging, custom type maps or type filters).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
0.6.1 1,142 5/2/2024
0.6.0 5,924 2/19/2024
0.5.1 223 1/21/2024
0.5.0 172 1/21/2024
0.4.2 2,418 7/24/2023
0.4.1 3,532 6/20/2023
0.4.0 4,727 3/1/2022
0.3.3 527 1/19/2022
0.3.2 478 1/18/2022
0.3.1 704 2/17/2021
0.3.0 683 10/14/2020
0.2.4 425 10/9/2020
0.2.3 733 5/19/2020
0.2.2 583 5/8/2020
0.2.1 622 2/25/2020
0.2.0 564 2/24/2020
0.1.9 550 12/13/2019
0.1.8 515 12/4/2019
0.1.7 623 8/25/2019
0.1.6 675 5/19/2019
0.1.5 608 5/1/2019
0.1.4 590 4/27/2019
0.1.3 681 4/20/2019
0.1.2 630 4/19/2019
0.1.0 612 4/16/2019

Adds support for custom type maps and a first prototype for class decorators.