devDependencies is used to define Dev Dependencies.
These are tools/libraries which you do not want to be in the production
They are usually meant for testing, documenting or ease development
They are installed with npm install <package> --dev
Peer Dependency
peerDependencies is used to define Peer Dependencies
These are usually meant for plugins
examples are babel plugins, express middleware
Consider example of dependencies:
node_modules |_ A | |_ node_modules | |_ B |_C |_ node_modules |_ B
Suppose A and C are packages which depends on B. Now the requirement is such that A should not install B instead it is fine to for B to be just installed irrespective of the version, then we can define B as peerDependencies of A, then while installing A it will not attempt to install B since it is already installed
Transitive Dependency
If package A has dependency B and dependency B has dependency C, then package A transitively depends on dependency C.
A (our project) → B (direct dependency) → C (transitive dependency) …