Reputation:
I would like to use Typescript instead of Object Oriented Javascript + Ecmascript in the conventional frontend.
What is the correct way to compile typescript for ecmascript, without there being any compatibility or error issues with @imports?
NOTE: I do not use the webpack, as I'm not doing SPA's, so I'd like the specific @import for each component on specific pages (.html).
Upvotes: 3
Views: 2111
Reputation: 1498
You need the typescript
npm package. It contains the tsc command to compile typescript to javascript. you can ether install it globaly or add it as a dev dependency to your project.
Globaly:
npm install -g typescript
tsc index.ts
Development Dependency:
npm install --save-dev typescript
node node_modules/bin/tsc.js index.ts
Instead of supplying an input file you can also configure the build using a tsconfig.json
in your current directory.
Upvotes: 4