2

First of all, I've heard that modern browsers are able to run TypeScript even without compiling it into JavaScript. If this assumption is wrong, please let me know, and this is the problem here.

In case I did understand correctly, my TypeScript code doesn't work in the browser. Here is the error:

enter image description here

Any help will be profoundly appreciated!

1 Answer 1

7

First of all, I've heard that modern browsers are able to run TypeScript even without compiling it into JavaScript

You've heard wrong. You need to compile to JavaScript.

You can use a script tag that has TypeScript in it ... but it will still compile to JavaScript before being passed to the Browser runtime. E.g. : https://github.com/basarat/typescript-script 🌹

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

1 Comment

is right. However you can debug the typescript files on your development computer using the browser developer tools

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.