Visual Studio has a Typescript addon for developing apps with the Typescript language.
And there is also the Node.js Tools for VS, with which one is able to create and debug Node.js applications.
I tried creating a Node.js project, but then I couldn't add Typescript files to it, and if I added them by hand, they did not get compiled to javascript (couldn't set their Build action to TypeScriptCompile.)
And if I create a simple Typescript project, then it does not start my app with Node, because it is basically just an ASP.Net web project.
Is it possible to somehow create a VS project that uses Typescript and Node.js integration at the same time?
You can use thousands of existing JavaScript libraries in your TypeScript project. Type definition files allow you to enjoy the type-checking and autocomplete features in libraries that were written in JavaScript. These files make you more productive in writing code.
The TypeScript compiler supports a mix of JavaScript and TypeScript files if we use the compiler option --allowJs : TypeScript files are compiled. JavaScript files are simply copied over to the output directory (after a few simple type checks).
TypeScript is well-established in the Node. js world and used by many companies, open-source projects, tools and frameworks. Some of the notable examples of open-source projects using TypeScript are: NestJS - robust and fully-featured framework that makes creating scalable and well-architected systems easy and pleasant.
Syntax. TypeScript doesn't consider any JavaScript code to be an error because of its syntax. This means you can take any working JavaScript code and put it in a TypeScript file without worrying about exactly how it is written.
Yes, it is possible, but in a somewhat awkward way (I hope Node.js Tools will support this better in the future).
You should create Node.js project and add a new file. Choose new text file and enter its name with .ts extension. It will create a typescript file.
At this point you will have a typescript files without compiled javascript.
To fix this go to VS "Tools" menu, open "Options" and go to "Text editor" > "TypeScript" > "Project" and under "Compile on Save" check "Automatically compile TypeScript files which are not part of a project and choose "Use commonjs...".
After that open each .ts file and save it - tsc will compile it to javascript.
Downside of this solution is that you have to remember to save manually each .ts you edit, but I think its not a big deal.
Here's a link to the post that helped me with the same problem: http://blog.ctaggart.com/2013/11/nodejs-tools-with-typescript-console-app.html
Update
If you grab the latest dev build of Node.js Tools you will see that TypeScript support is added. you can create TypeScript project (and this includes debugging .ts files feature)
https://nodejstools.codeplex.com/discussions/531222
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With