Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tsc command output empty js file

I am learning Angular/Typescript and found my first issue. Don't even know how to ask it correctly. Searched it around and got nothing.

I have a main.ts file with this code

function myFunc(x,y){
    return x+y;
}

let num = 2;
const PI = 3.14;

When I do the command

tsc main.ts

It creates an empty file named main.js

In the video course I am watching, the generated file is populated with the corresponding javascript.

What should I do? Thanks in advance

like image 588
Lucas Avatar asked Nov 05 '17 12:11

Lucas


2 Answers

I encountered a similar issue. I quickly realized that I haven't save the main.ts file on VS code by running:

cat main.ts

In that case, you are basically compiling an empty file. I guess the tutorial did not bother to mention that you should manually save your file.

like image 159
Jeonkwan Avatar answered Oct 09 '22 12:10

Jeonkwan


You first need to save the file. (Ctrl + s). Otherwise compiler will compile an empty file.

So you should manually save the file.

like image 3
Abdullah Khan Avatar answered Oct 09 '22 11:10

Abdullah Khan