DEV Community

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

Discussion (3)

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.
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

philippurwoko profile image
Philip Purwoko Author

Okay. Thank you for all of your explanation