admin 管理员组

文章数量: 1086019

Is it possible to use TypeScript instead of JavaScript in a Django project developed using Visual Studio?

At the moment I just tried to add a .ts file and import it to a HTML file. It fails when finding non-Javascript syntax though. I was wondering what I was missing.

Do I have to configuration Visual Studio for it? (TypeScript sdk is already installed).
Is it going to pile the .ts files into JavaScript by itself or do I have to go through extra steps?

Is it possible to use TypeScript instead of JavaScript in a Django project developed using Visual Studio?

At the moment I just tried to add a .ts file and import it to a HTML file. It fails when finding non-Javascript syntax though. I was wondering what I was missing.

Do I have to configuration Visual Studio for it? (TypeScript sdk is already installed).
Is it going to pile the .ts files into JavaScript by itself or do I have to go through extra steps?

Share Improve this question asked Feb 16, 2020 at 11:52 Alvin SartorAlvin Sartor 2,4794 gold badges24 silver badges42 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

You are going to have to pile your Typescript files in Javascript files.

The best way to do this is to use the tsc mand available to you when installing typescript with a package manager like NPM.

Make sure you then import your Javascript files in your HTML files. If you're using Django Templates, then use Static Files to link to the appropriate Javascrpt files.

I hope this helps you :)

本文标签: javascriptHow do I add TypeScript files in a Django project made with Visual Studio 2019Stack Overflow