DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Philip Purwoko
Philip Purwoko

Posted on

Should I install Typescript globally or at DevDependency ?

Hello, I am familiar with Javascript but I am new to Typescript. I install typescript globally using npm install -g typescript. Should I install Typescript globally or at DevDependency ? And does it matter ?

Also I use VSCode, when I compile the script using tsc script.ts and open the script.js I got an error at typescript file Duplicate identifier 'some variable' 'some variable' was also declared here. But if I close the .js file and only open the .ts file, the errors is gone. The script is just fine.

I really appreciate for all of your responses. Thank you

Top comments (3)

Collapse
 
aerabi profile image
Mohammad-Ali A'RΓ‚BI

Installing as a dev dependency has a few benefits:

  • It specifies which version of TypeScript did you use.
  • In CI/CD pipeline, it is installed without a further instruction.
  • The same is true with other developers working on your project.
Collapse
 
nekorytaylor666 profile image
Akhmetov Tokhtar

Since it’s only a development tool and it usually compiles straight to JavaScript it should be a dev dependency

Collapse
 
philippurwoko profile image
Philip Purwoko Author

Okay. Thank you for all of your explanation

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.