GithubHelp home page GithubHelp logo

Welcome to ToTypeScriptD

You can now generate TypeScript definition (*.d.ts) files from either .Net or .winmd assembly files. Allowing you to leverage these libraries in your TypeScript/JavaScript WinJS or other client side software applications with all the type safety and benefits of TypeScript.

Can you tell me why I would use this?

I know of two main scenarios where I think this could be useful.

  1. If you build a 'Modern' (come on, we still call it Metro) Windows 8 app with WinJS and want to leverage TypeScript, wouldn't it be nice to get a set of TypeScript Definition files that reflect the native API's you're calling in the platform without manually creating the definition files?
  2. Say your building an MVC/WebAPI server application. It would be useful if your C.I./Build system could spit out a set of TypeScript interfaces that were based on the server objects used to render your API. This can provide not only useful for client side JavaScript/TypeScript libraries that need to consume these objects, but could also provide a simple way to document the structure of your service API results.

Install

Install via Chocolatey

cinst ToTypeScriptD

You can see the Chocolatey package here: ToTypeScriptD package

How to use?

Print the short and sweet command line arguments:

ToTypeScriptD --help

Generate all types from Windows.winmd file:

ToTypeScriptD winmd "C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral\Windows.winmd"

Generate all types from multiple .winmd files:

ToTypeScriptD winmd C:\Windows\System32\WinMetadata\Windows.Foundation.winmd C:\Windows\System32\WinMetadata\Windows.Networking.winmd

Include the special types for WinJS apps:

ToTypeScriptD winmd --specialTypes C:\Windows\System32\WinMetadata\Windows.Foundation.winmd

Filter types in a specific namespace

ToTypeScriptD winmd --specialTypes C:\Windows\System32\WinMetadata\Windows.Foundation.winmd --regexFilter "Windows.Foundation.Collections"

Roadmap

Checkout the project milestones, suggest a feature, bug etc. Or even better, submit a pull request.

Contribute

Checkout the Contribution guide.

Thanks to!

Partially sponsored by:
Resgrid logo

How does the magic happen?

By loading assembly metadata with Mono.Cecil which can read any Ecma 355 Common Language Infrastructure (CLI) file, we can generate a set of TypeScript definition files that allow us to project the type system from these assemblies into TypeScript Definition files. Cool eh?

totypescriptd's Projects

samplewin8 icon samplewin8

Walks through how to convert a Win8 WinJS application to use TypeScript

totypescriptd icon totypescriptd

Generate TypeScript Definition files from Ecma 355 [Common Language Infrastructure (CLI)] (*.winmd/.net dll's).

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.