I am wondering if I can somehow extend or hook up to the TypeScript compiler and generate some functions based on the declaration of the TypeScript interfaces in my code. Basically these functions would validate the data objects that are coming from the server to comply with the TypeScript interfaces the objects are supposed to implement. I was thinking to have a special interface-marker and I wish my hook to the compiler was triggered by such interface. Once that marker-interface is detected I would analyze the members of that interface and generate the code that would validate a given object against the data-contract defined by that interface. Is there a way to do that? Can anyone give some directions[?](https://typescript.codeplex.com/discussions/502864)