Looking for way to export type-data and use at run-time

Topics: General
Nov 4, 2013 at 1:41 PM
I would like to be able to at compile-time extract the type model and use it at runtime for various purposes.

One is being able to generate something like a json-schema (or altenratives). Another is generating duck-type tests.

Maybe the compiler can use an keyword or comment-based annotation to inject this model into a given variable.

I can see how this could work as a pre-processor using the compiler code and the SyntaxTree (similar to how TSLint extracts and walks the tree).

Anyone got ideas on this?
Nov 4, 2013 at 7:23 PM
Edited Nov 4, 2013 at 7:23 PM
There was a related discussion recently.

I too would like to see this for what you call "duck-type" tests or fakes, for which there is an issue ticket out.

I prefer that TypeScript not create any variables or functions in order to provide this, because that hints at TypeScript evolving into something that borders on a framework (a completely undesirable scenario IMO!).

Rather I would like to see TypeScript generate a types meta file containing the necessary type information in JavaScript format.
Nov 4, 2013 at 7:29 PM
@Bartvds, just noticed that you had commented on the related issue. Not sure what's going on. Short term amnesia?! :-)
Nov 4, 2013 at 7:40 PM
@nabog I never saw those replies, so I'd reposted top-level.

Looks like I assumed email-notifications to be enabled by default like on github, but I enabled them now. (I did get you messages.. because I created the thread?

Thanks for noting this as there is some good stuff in the other thread.,
Nov 4, 2013 at 9:05 PM
Ah! that explains it.

I don't use the email notification mechanism myself, instead I have a simple rule for keeping up-to-date: Every time Visual Studio crashes on me I visit the forum while waiting for it to restart and reload all my projects.

I am here quite often.
Coordinator
Nov 4, 2013 at 9:24 PM
... wishing I could 'like' a forum post right about now.
Nov 4, 2013 at 9:37 PM
My WebStorm doens't come with this periodic go-do-something-else trigger so that explains it then :D