admin管理员组

文章数量:1399907

I'd like to run the TypeScript piler within a website in order to build something like the playground on TypeScript's website TypeScript Playground.

In opposite of running tsc on the server side, I'd like to run pile it directly within JS. I've looked for any similar posts here and any description within the TypeScript language specification, but I can't find any information on that.

I'd like to run the TypeScript piler within a website in order to build something like the playground on TypeScript's website TypeScript Playground.

In opposite of running tsc on the server side, I'd like to run pile it directly within JS. I've looked for any similar posts here and any description within the TypeScript language specification, but I can't find any information on that.

Share Improve this question edited Jan 29, 2013 at 16:23 sepp2k 371k56 gold badges681 silver badges684 bronze badges asked Jan 29, 2013 at 16:23 Thorsten HansThorsten Hans 2,68320 silver badges21 bronze badges 1
  • 1 possible duplicate of TypeScript Web-Based IDE - hopefully that will answer your question. – Fenton Commented Jan 29, 2013 at 17:06
Add a ment  | 

3 Answers 3

Reset to default 2

The typescript piler is written in Typescript, so you can load the piler (typescript.js) into your browser. But bare in mind that it is slightly heavy (roughly 250 KB).

There's some documentation on the TS Compiler API and there's also typestring - a wrapper that is still intended for use in NodeJS, but you can use it as a starting point.

Yes, it's possible to use TypeScript piler in the browser without any hack. Checkout my examples playground and monaco-editor demos in this answer: TypeScript Web-Based IDE

本文标签: javascriptHow to run TypeScript compiler within a websiteStack Overflow