Can we use JavaScript for Angular development in place of TypeScript? I am new to Angular development and got this question into my mind. Can someone please answer this.
2 Answers
Any JavaScript code is valid TypeScript too (as TS is a superset of JS), so it's perfectly possible to just write JavaScript inside .ts files and it should work properly. The only thing that might get in the way is the TypeScript transpiler if it's set to be overly strict about type declarations, but by default it isn't.
Comments
Yes, but Angular 2 is designed around Typescript, and makes heavy use of its annotation processing features, requiring inelegant workarounds if they are not available. I would recommend either using Typescript, as the features it adds to javascript are minimal and non-compulsory, or using another framework designed to be used with pure javascript.