Skip to content

Automatically compile TypeScript 1.8.10 to JavaScript in the browser

Notifications You must be signed in to change notification settings

s7726/typescript-compile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Compile

Current Version: TypeScript 1.8.10


TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language.

TypeScript needs to be compiled as currently browsers do not support the full set of features supported by TypeScript. With TypeScript Compile you can include TypeScript files in the browser and have them compile at runtime.

TypeScript Compile automatically transforms your TypeScript code into JavaScript on the fly! Just write your TS code between:

<script type="text/typescript">
    ...
</script>

or include your TS file:

<script type="text/typescript" src="demo.ts"></script>

and add these two JS files at the end of the HTML body:

<script type="text/javascript" src="typescript.min.js"></script>
<script type="text/javascript" src="typescript.compile.min.js"></script>

That's it! TypeScript will be compiled to JavaScript and immediately run, by appending the compiled script to the HTML body.

Note: You probably don't want to do this on a production website/application but running the TypeScript directly in your browser can help while you are developing.

Demo

Here is a live demo

Download

TypeScript 1.8.10 (minified JS)

TypeScript Compile 0.5 (minified JS)

TypeScript Compile 0.5 (development JS)

Developing and Updating

If you would like to upgrade typescript-compile to the latest version of TypeScript please have a look at the wiki entry: https://github.com/markwylde/typescript-compile/wiki/Updating-TypeScript

@markwylde did a great job on the wiki entry, but it there were a few sticking points I ran into:

  • The typescript files needed are in different folders now
    • They are both in the ./lib folder rather than the ./bin folder
  • The minifyer he suggests did not strip the comments correctly
  • the demo should be hosted to prevent modern browsers from preventing loading of some of the files
    • npm install http-server or something similar is your friend
    • run http-server in the base directory of the checkout and visit http://127.0.0.1/demo/demo.html that way the path to the js files will resolve correctly (CORS issues)

Authors & License

TypeScript is developed by Microsoft Corp. under Apache 2.0 License.

TypeScript Compile is developed by Jerzy Głowacki under Apache 2.0 License.

TypeScript Compile has been updated for TypeScript 1.5-alpha by Mark Wylde under Apache 2.0 License.

About

Automatically compile TypeScript 1.8.10 to JavaScript in the browser

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%