Introducing ToTypeScriptD – Automatic TypeScript Definition files for C++/CX or .Net assemblies.
It’s true that the TypeScript team has created a set of TypeScript Definition files for WinRT and WinJS, but I couldn’t get any comment as to how they were generated. And the more I looked into what was provided, the more I realized that there were inconsistencies and inaccuracies that were not good. Which led me to believe that they weren’t working on a super-secret tool to automatically generate these for us.
What is ToTypeScriptD ?
ToTypeScriptD is a quick little attempt at automatically taking the type system provided to us by a C++/CX winmd or .Net assembly file and projecting that into a set of TypeScript Definition files. This tool can basically take anything that is Ecma 355 Common Language Infrastructure (CLI) and spit out a .d.ts file for you automatically.
Why would I need this?
In the project readme I describe two use-cases that I know of (so far).
- If you build a ‘Modern’ (come on, we still call it Metro) Windows 8 app with
WinJSand 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?
How do I get the project and start using it?
Before you install the tool and dive in head first, I would like warn you that I have only been working on this for about 2 weeks (in my off-hours) and there is going to be lots of room for improvement. But it’s currently generating a solid set of .d.ts files for .winmd files.
I’d would love to hear feedback. If anyone is interested in helping out, you can submit new issues or review the open issues list and start submitting pull requests.