Client Side Compiler

Topics: General
Oct 3, 2012 at 11:43 PM
Edited Oct 3, 2012 at 11:52 PM

I was wondering if there is a version of the TypeScript compiler made for running on the client side(browser). It seems like the playground is using something like this already and I was curious how possible it would be to use this myself.

Oct 4, 2012 at 7:08 AM

If you download the commandline compiler, you can compile it to js suitable for running in a browser- after all, it's just javascript. However, other than the use case where you need to be transcompiling arbitrary TypeScript code to JavaScript code at runtime (eg, you're building something similar to the playground), the compilation step should be a build-time step, with only JavaScript being sent to the browser.

Coordinator
Oct 5, 2012 at 5:05 PM

That's right.  The TypeScript compiler compiles to .js, which can be run from a browser.  What you're using in the Playground is the TypeScript compiler itself.

Oct 5, 2012 at 9:03 PM
Edited Oct 5, 2012 at 9:03 PM

Looks like someone already beat me to what I was describing:

https://github.com/niutech/typescript-compile

I guess I probably wasn't very clear in my initial question. I was mostly looking for something that was a little more tailored to support it already. Personally I was kinda surprised this approach wasn't already looked at, as I could see this being expanded to eventually even allow browsers to compile typescript natively, with the js compiler as a fallback.

Oct 5, 2012 at 9:08 PM
The same is available for coffeescript, but is rarely used.
Debugging is more difficult and the extra step on the client (especially mobile devices) is non-negligible.
From: path411
Sent: ‎October‎ ‎5‎, ‎2012 ‎4‎:‎03‎ ‎PM
To: joewood@live.com
Subject: Re: Client Side Compiler [typescript:397959]

From: path411

Looks like someone already beat me to what I was describing:

https://github.com/niutech/typescript-compile

I guess I probably wasn't very clear in my initial question. I was mostly looking for something that was a little more tailored for support it already. Personally I was kinda surprised this approach wasn't already looked at, as I could see this being expanded to eventually even allow browsers to compile typescript natively, with the js compiler as a fallback.