It's probably the most famous dilemma after Chicken or the egg, should I install this dependency in dependencies or in devDependencies?

Let's see what npm and yarn say about it:

NPM

dependencies: Packages required by your application in production.
devDependencies: Packages that are only needed for local development and testing.

(https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file)

YARN

dependencies: These are your normal dependencies, or rather ones that you need when running your code (e.g. React or ImmutableJS).
devDependencies: These are your development dependencies. Dependencies that you need at some point in the development workflow but not while running your code (e.g. Babel or Flow).

(https://yarnpkg.com/en/docs/dependency-types#toc-dependencies)

There is a discrepancy between the two approaches, because npm is suggesting to install modules like babel or @types (needed at build time) as dependencies but yarn is suggesting to install them as devDependencies. So what to do?

I decided to give a look to two of the one-line installers I used lately the uber famous create-react-app and the new born create-next-app. They both install all the dependencies as normal one.

"dependencies": {    
  "@types/jest": "24.0.22",
  "@types/node": "12.12.6",
  "@types/react": "16.9.11",
  "@types/react-dom": "16.9.4",
  "react": "^16.11.0",
  "react-dom": "^16.11.0",
  "react-scripts": "3.2.0",
  "typescript": "3.7.2"
  },
package.json created by create-react-app

So create-react-app, that is maintained by Facebook (same maintainer of yarn), is installing all the @types (using yarn) not accordingly to what suggested by yarn itself.

Another reason to adopt the npm convention is installing dependencies with --production (or --prod or -p) flag. npm install --production or yarn --production is going to install only the packages inside dependencies, excluding the one in devDependencies. This could be particularly helpful if you want to install all the dependencies needed to spin up your project. This is not possible if you have your @types or babel files in devDependencies.

TL;DR

Can you build and run your application without this dependency? Yes, devDependencies, No, dependencies.