TypeSharp is a C# to TypeScript transpiler. You can try it out here. See the samples on the left.

We are looking for funding and sponsorship, so please get in touch!

Please contact info@typesharp.co for more info, including licensing.

For certain functions, TypeSharp provides a helper package: @brandless/tsutility

    // C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            int num,
            sum = 0,
            r;
            Console.WriteLine("Enter a number: ");
            num = int.Parse(Console.ReadLine());
            while (num != 0)
            {
                r = num % 10;
                num = num / 10;
                sum = sum + r;
            }
            Console.WriteLine("Sum: " + sum);
            Console.ReadLine();
        }
    }
}
  
    // TypeScript
export class Program {
    static Main(args: Array<string> | null) : void {
        let num: number = 0,
        sum = 0,
        r = 0;
        console.log(`${(`Enter a number: `)}
`);
        num = parseInt(<any>(<any>prompt()));
        while (num != 0) {
            r = num % 10;
            num = num / 10;
            sum = sum + r;
        }
        console.log(`${(`Sum: ` + sum)}
`);<any>prompt();
    }
}
  
    // C#
namespace TypeSharp.Web.FrontEnd
{
    public class MyClass1
    {
        public string Hello(string name)
        {
            return $"Hello {name}";
        }
    }
}
  
    // TypeScript
export class MyClass1 {
    public Hello(name: string | null) : string | null {
        return `Hello ${name}`;
    }
}