kdocs
GitHub
Lang - Web
Lang - Web
  • Base
    • Css
    • Javascript
    • Typescript
      • New Project
  • Frameworks
    • Angular
      • Directives
      • Components
      • Templates
        • Bindings
        • Control Flow
        • Variables
      • Signals
      • Pipes
      • Services
        • Dependency Injection
      • Forms
        • Reactive Form
        • Template-Driven Form
      • Router
      • HTTP Client
      • Observables RxJS
      • Testing
        • Components
        • Directives
        • Pipes
        • Services
      • Optimization & Performance
      • Security
Powered by GitBook
On this page
  1. Base
  2. Typescript

New Project

Tips for initializing a new project blank project

What you need to start a project from zero.

  • Start the node config file package.json with npm --init.

  • Install the Typescript as a dependency.

    • Create a config file for Typescript tsconfig.json, with npx tsc --init.

  • Transpile the Typescript code with npx tsc.

    • The transipled .js will be at the outDir path.

  • Then for last you just run the Javascript code.

Automating the transpilation and execution

At the package.json, you can create a new script:

  • tsc && node dist/main, where dist is the outDir specified and main is the main.js or the starting execution script.

OR

You can install ts-node, which is a Typescript dependency for running Typescript directly.

  • npm install ts-node.

  • Then just run ts-node main.ts.

And if you install nodemon it will also recognize Typescript with ts-node, and keep running the Typescript application.

PreviousTypescriptNextAngular

Last updated 7 months ago