Issue
Let's say that I have a build up MEAN application written in JS, and I want to keep it but add some classes/interfaces using TS (I want to do this because I want interfaces) and use it in my controllers to communicate with my backend. Is it possible? If yes, how do i do it?
Thanks in advance!
Solution
Since TypeScript is a superset of javascript all JS code will work in typescript BUT you need to change the file extensions from .js to .ts
Furthermore, all typescript code must be compiled back to javascript before run. which means a typescript compiler has to be installed and configured.
That was my answer to your question.
As a piece of advice since you are building with MEAN stack then you are used to Angular way of structuring code.
If that is the case then you can build your server the same way with TypeScript using a framework called NestJS which is very very similar to Angular:
Answered By - Mohamed Aljamil
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.