Code Monkey home page Code Monkey logo

typescriptdefinitiongenerator's Introduction

TypeScript Definition Generator

Build status

For Visual Studio 2022:
Download this extension from the Marketplace or get the CI build.

For Visual Studio 2019:
Download this extension from the Marketplace or get the CI build.


Creates and synchronizes TypeScript Definition files (d.ts) from C#/VB model classes to build strongly typed web application where the server- and client-side models are in sync. Works on all .NET project types

See the change log for changes and road map.

For Visual Studio 2015 support, install Web Essentials 2015

From C# to .d.ts file

This extension will automatically generate .d.ts files from any C#/VB file you specify. It will turn the following C# class into a TypeScript interface.

class Customer
{
    public int Id { get; set; }
    public string Name { get; set; }
    public IEnumerable<string> Tags { get; set; }
}

Becomes this .d.ts file:

declare module server {
	interface customer {
		id: number;
		name: string;
		tags: string[];
	}
}

The generated .d.ts file can then be consumed from your own TypeScript files by referencing server.<typeName> interfaces.

Generate d.ts file from C#/VB

To generate a .d.ts file, right-click any .cs or .vb file and select Generate TypeScript Definition.

Context menu

A .d.ts file is created and nested under the parent C#/VB file.

Nested file

Every time the C#/VB file is modified and saved, the content of the .d.ts file is updated to reflect the changes.

Settings

Configure this extension from the Tools -> Options dialog.

Settings

Contribute

Check out the contribution guidelines if you want to contribute to this project.

For cloning and building this project yourself, make sure to install the Extensibility Tools 2015 extension for Visual Studio which enables some features used by this project.

License

Apache 2.0

typescriptdefinitiongenerator's People

Contributors

madskristensen avatar epiccinionit avatar kvart714 avatar cbke avatar csharpfiasco avatar linusnoren avatar anttipih-predisys avatar mbreaton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.