How to Complile TypeScript in Browser Via CDN

To complie and run TypeScript, one just need to add stand-alone Babel CDN in the HTML file.

Example code

<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script type="text/babel">
  function call(name:string){
 	return "hi " + name + "."; 
 };

console.log(call('John'));
//hi John.
</script>

Comments

Popular posts from this blog

How to Make A Reusable Image Slideshow HTML Component With Vanilla JavaScript

HTML Tags and Inline CSS that Work In Plotly.js Title

How to Type Spaces In HTML Input And Display In the Browser