6

I'd like to run the TypeScript compiler 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 compile 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.

1
  • 1
    possible duplicate of TypeScript Web-Based IDE - hopefully that will answer your question. Commented Jan 29, 2013 at 17:06

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, but how do you wield it? How do you compile the contents of one textarea into another?
2

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.

Comments

2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.