From WebIDL to TypeScript Interfaces

Hi everybody,

Today, I worked on interface-level conversion of WebIDL. The first thing you need to do when using an external library (in this case the WebIDL parser of Robin Berjon) is to understand its structure.

So, I create an interface-based definition of the AST returned by WebIDL in TypeScript, which enables code autocompletion as a bonus.

https://github.com/extensibleweb/webidl.js/blob/typescript/typescript/WebIDL.ts

After this, I created a toy project whose goal is to convert Web Interface Definitions to TypeScript interfaces (this is a first step before creating JavaScript code because TypeScript will be able to check that the generated javascript code is conforming to the original interface as much as possible (at least, that it conforms to the TypeScript interfaces).

You can find a small test here:

https://github.com/extensibleweb/webidl.js/blob/typescript/typescript/default.htm

This is a first step. The next one will be to cover more of the WebIDL features, then start working on the JavaScript code generator.

François 		 	   		  

Received on Tuesday, 29 January 2013 22:10:33 UTC