Sujood Sujood - 4 months ago 33
TypeScript Question

how to connect my typescript file to server

I just got started with Angular 2 and trying to learn it.
I am using Visual Studio Code.
how can I let the server watch what happens in the typescript file?
Should I be using some sort of compiler to javascript for that?

thanks in advance!


The typescript files are transpiled (converted) to Javascript before they can be useful. This is because browsers do not execute typescript. This means that you need to use the typescript compiler. The server cannot directly watch what's happening (what do you mean anyhow?) in .ts because these files are not run directly.

Once the .ts becomes .js, it can be used as any Javascript would. If your application runs in the browser, you can let the server know what's going on by using HTTP requests as all websites do.

If you're running Javascript on the server (eg: Node) then please elaborate on what you mean. Your question is a bit confusing.

You tagged this question angular2, so I assume that this is the context in which you will be using Typescript. I recommend starting here.