27 lines
		
	
	
		
			785 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			785 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <html>
 | |
| <head></head>
 | |
| <body style="display: flex; gap: 30px;">
 | |
| <textarea id="input"></textarea>
 | |
| <button style="align-self: center;" id="transpile">→</button>
 | |
| <textarea id="output"></textarea>
 | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/4.5.4/typescript.min.js"></script>
 | |
| <script type="module">
 | |
| const domIn = document.getElementById("input");
 | |
| const domOut = document.getElementById("output");
 | |
| const domDo = document.getElementById("transpile");
 | |
| 
 | |
| domDo.addEventListener("click", ()=>{
 | |
|     const result = ts.transpileModule(domIn.value, {
 | |
|         compilerOptions: { 
 | |
|             module: ts.ModuleKind.ESNext, 
 | |
|             target: ts.ScriptTarget.ESNext 
 | |
|         }
 | |
|     });   
 | |
|     domOut.value = result.outputText
 | |
|     console.log(result); 
 | |
| })
 | |
| 
 | |
| </script>
 | |
| 
 | |
| </body>
 | |
| </html> |