简体   繁体   中英

TypeScript/JavaScript in Angular

I'm a beginner level in writing in TypeScript and working with Angular, but I am experienced in JavaScript. From what I've read, any TypeScript would be translated into JavaScript and compiled. So when I code in the TypeScript file (eg the whatever.component.ts file), does that mean I can mix or introduce JavaScript language code inside where I also write TypeScript in the .ts file?

How does this all exist within the .ts file in regards to a code readability aspect for someone who is just learning TypeScript/Angular?

You can of course use JavaScript anyhow you like it. However, TypeScript is built to help the developers maintaining projects by using variables types. The types can then easily be read and previewed by good IDE with the appropriate extensions.

Get used to adding types. Use interfaces for custom objects, embrace the Angular way and you will forget you ever had to deal with JavaScript very soon.

A good base for productive IDE would be Visual Studio Code with the Angular Essentials extension.

Welcome to the Angular community!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM