Embed TypeScript code in an HTML document

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).

Leave a Comment