Is it possible to embed TypeScript code in a web page? I want to embed TypeScript code inside script tags, like this (so that it is automatically compiled to Javascript):
<script type = "text/typescript">
//TypeScript code goes here
</script>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually there are several projects that allow you to use TypeScript code like that – TypeScript Compile, ts-htaccess.
The catch here is that .ts code should be compiled into JavaScript – it can be done either at client-side (slow; the whole TSC should be loaded into the client as well) or at server-side (obviously faster, and it’s far easier to leverage the cache on the compiled code).