I was wondering if it is possible to utilise @babel/plugin-transform-typescript
to translate typescript code to javascript code when the function is called during user interaction, for example, when the user clicks on a button. My goal is to show the source code on the page as you can see below. So far I managed to put it only in typescript; however, I want to also be able to view it in JS
The code that I have right now:
The problem is that I get this error when I click on the button that triggers the function:
Do you have any suggestion how to resolve this issue? Any help will be greatly appreciated.