title: Typescript: Compilation Error only when using Docker
body: <p>So I have this weird error when Typescript would throw a Compilation Error when I try to to run my app using Docker. This error does not happen when I run it locally on my computer.</p>
  <p>My Dockerfile</p>
  <pre><code>FROM node:alpine
  
  WORKDIR /app
  
  COPY package.json .
  RUN npm install --only=prod
  COPY ./ ./
  
  CMD [&quot;npm&quot;, &quot;start&quot;]
  </code></pre>
  <p>Package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;auth&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;Authorization Service for Ticketting&quot;,
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;type&quot;: &quot;module&quot;,
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;ts-node-dev --no-deps --respawn --poll --interval 1000 src/index.ts&quot;,
      &quot;test&quot;: &quot;jest --watchAll --no-cache&quot;
    },
    &quot;jest&quot;: {
      &quot;preset&quot;: &quot;ts-jest&quot;,
      &quot;testEnvironment&quot;: &quot;node&quot;,
      &quot;setupFilesAfterEnv&quot;: [
        &quot;./src/test/setup.ts&quot;
      ]
    },
    &quot;author&quot;: &quot;Nam Nguyen&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;devDependencies&quot;: {
      &quot;@types/jest&quot;: &quot;^26.0.15&quot;,
      &quot;@types/supertest&quot;: &quot;^2.0.10&quot;,
      &quot;jest&quot;: &quot;^26.6.3&quot;,
      &quot;mongodb-memory-server&quot;: &quot;^6.9.2&quot;,
      &quot;supertest&quot;: &quot;^6.0.1&quot;,
      &quot;ts-jest&quot;: &quot;^26.4.4&quot;
    },
    &quot;dependencies&quot;: {
      &quot;@nnticketting/common&quot;: &quot;^1.0.5&quot;,
      &quot;@types/cookie-session&quot;: &quot;^2.0.41&quot;,
      &quot;@types/cors&quot;: &quot;^2.8.8&quot;,
      &quot;@types/express&quot;: &quot;^4.17.8&quot;,
      &quot;@types/jsonwebtoken&quot;: &quot;^8.5.0&quot;,
      &quot;@types/mongoose&quot;: &quot;^5.10.0&quot;,
      &quot;cookie-session&quot;: &quot;^1.4.0&quot;,
      &quot;cors&quot;: &quot;^2.8.5&quot;,
      &quot;dotenv&quot;: &quot;^8.2.0&quot;,
      &quot;express&quot;: &quot;^4.17.1&quot;,
      &quot;express-async-errors&quot;: &quot;^3.1.1&quot;,
      &quot;express-validator&quot;: &quot;^6.6.1&quot;,
      &quot;jsonwebtoken&quot;: &quot;^8.5.1&quot;,
      &quot;mongoose&quot;: &quot;^5.10.13&quot;,
      &quot;ts-node&quot;: &quot;^9.1.0&quot;,
      &quot;ts-node-dev&quot;: &quot;^1.0.0&quot;,
      &quot;typescript&quot;: &quot;^4.1.2&quot;
    }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/l0hg3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l0hg3.png" alt="Error" /></a></p>
  <p>And these are the codes that Typescript is complaining about. Apparently Typescript is expecting 1 argument for the &quot;done()&quot; callback which makes no sense.</p>
  <pre><code>userSchema.pre('save', async function (done) {
    if (this.isModified('password')) {
      const hashed = await Password.toHash(this.get('password'));
      this.set('password', hashed);
    }
    done();
  });
  </code></pre>