Home > OS >  error TS6054: File 'app/app.ts.' has an unsupported extension
error TS6054: File 'app/app.ts.' has an unsupported extension

Time:09-03

Message error: "error TS6054: File 'app/app.ts.' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.cts', '.d.cts', '.mts', '.d.mts'". The file is in the program because: Root file specified for compilation Found 1 error.

I'm following a programming course, they're making us set up Typescript to work with Angular. I installed both NodeJS and TSC as they asked. Then as a test run they're making us create an "app.ts" file inside an "app" folder on VSC. They make us write a "Hello World" on it, and then compile the file using the command "tsc app/app.ts." which is supposed to generate a new "js" file. I did it once successfully, but messed something else up later on, so I'm retracking my steps with a new project. The thing is now I get this error when running "tsc app/app.ts.", the file has an unsupported extension which I don't get because the extension of the file is ".ts", which is an allowed file extension according to the error itself.

Edit: I already checked if it could be a typo and tried both "app.ts." and "app.ts" the second of those throws the error TS6053: File 'app/app.ts' not found. Plus, I remember the first time around the command "tsc app/app.ts." with period and everything worked just fine. I remember this because I also thought the period at the end was a typo at first, considering file extensions don't end on one. But alas, it does include the period, otherwise the file isn't even recognized.

Could it have something to do with where the file is?

Edit: Welp, turned out it was indeed a typo I think. They messed up the textbook which shows the command with the period at the end. I moved the TS file another level into the folder, then ran the command from one level up from it, without the period and it worked. I feel really silly, but thank you very much for the help. I'll try it again to make sure it was the typo and not something related with the file being at the root of the folder or not.

CodePudding user response:

Change the filename from app.ts. to app.ts

Remove the extra dot (.) at the end. Maybe its a typo.

If typo is not the issue, Closing and opening Visual Studio will fix this issue.

  • Related