title: Angular app with typescript build error on Azure DevOps pipeline - error TS2677
body: <p>The following error is happening only during <strong>Npm@1</strong> task on the DevOps pipeline. The app builds just fine locally. No errors at all.</p>
  <p>Angular CLI version is 8.3.29 and TypeScript version is 3.5.3.</p>
  <p>It's executing this custom command:</p>
  <pre><code>run build:artifact
  </code></pre>
  <p>and that custom command points to this in <code>package.json</code>:</p>
  <pre><code>ng build --configuration=artifact
  </code></pre>
  <p>The error being thrown is:</p>
  <blockquote>
  <p>../node_modules/@types/lodash/common/lang.d.ts:577:74 - error TS2677:
  A type predicate's type must be assignable to its parameter's type.</p>
  </blockquote>
  <p>Full log from the pipeline:</p>
  <pre><code>Starting: Angular Build
  ==============================================================================
  Task         : npm
  Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
  Version      : 1.202.0
  Author       : Microsoft Corporation
  Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm
  ==============================================================================
  C:\Windows\system32\cmd.exe /D /S /C &quot;C:\hostedtoolcache\windows\node\14.15.0\x64\npm.cmd --version&quot;
  6.14.8
  C:\Windows\system32\cmd.exe /D /S /C &quot;C:\hostedtoolcache\windows\node\14.15.0\x64\npm.cmd config list&quot;
  ; cli configs
  metrics-registry = &quot;https://registry.npmjs.org/&quot;
  scope = &quot;&quot;
  user-agent = &quot;npm/6.14.8 node/v14.15.0 win32 x64&quot;
  
  ; environment configs
  prefix = &quot;C:\\npm\\prefix&quot;
  userconfig = &quot;D:\\a\\1\\npm\\11507.npmrc&quot;
  
  ; globalconfig C:\npm\prefix\etc\npmrc
  cache = &quot;C:\\npm\\cache&quot;
  
  ; node bin location = C:\hostedtoolcache\windows\node\14.15.0\x64\node.exe
  ; cwd = D:\a\1\s\client-site-spa
  ; HOME = C:\Users\VssAdministrator
  ; &quot;npm config ls -l&quot; to show all defaults.
  
  C:\Windows\system32\cmd.exe /D /S /C &quot;C:\hostedtoolcache\windows\node\14.15.0\x64\npm.cmd run build:artifact&quot;
  
  ERROR in ../node_modules/@types/lodash/common/lang.d.ts:577:74 - error TS2677: A type predicate's type must be assignable to its parameter's type.
    Type 'EmptyObjectOf&lt;T&gt;' is not assignable to type 'T'.
      'EmptyObjectOf&lt;T&gt;' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'object'.
        Type 'EmptyObject&lt;T&gt;' is not assignable to type 'T'.
          'EmptyObject&lt;T&gt;' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'object'.
  
  577         isEmpty&lt;T extends object&gt;(value: T | null | undefined): value is EmptyObjectOf&lt;T&gt; | null | undefined;
                                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! project-angular@0.0.0 build:artifact: `ng build --configuration=artifact`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the project-angular@0.0.0 build:artifact script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     C:\npm\cache\_logs\2022-08-17T15_41_17_869Z-debug.log
  
  &gt; project-angular@0.0.0 build:artifact D:\a\1\s\client-site-spa
  &gt; ng build --configuration=artifact
  </code></pre>
  <p>Do you know how to hunt down where this error is being thrown?</p>
  <p>When I run the same command [ <code>ng build --configuration=artifact</code> ] manually on my dev box with matching node\npm versions, no error happens:</p>
  <p><a href="https://i.stack.imgur.com/bbLqn.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/bbLqn.jpg" alt="enter image description here" /></a></p>
  <p>#######</p>
  <p>After deleting the <code>node_modules</code> folder and <code>package-lock.json</code> file as MikeOne suggested, I was able to get the same error from the pipeline locally... however it still doesn't tell us in what file the error is happening. :|</p>
  <p><a href="https://i.stack.imgur.com/RNUNX.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/RNUNX.jpg" alt="package-lock" /></a></p>
  <p>#######</p>
  <p>There's no indication this error is happening anywhere on my own source code. Would this be an error from <code>lodash</code> itself? I'm using the latest version available as of now <a href="https://www.npmjs.com/package/lodash" rel="noreferrer">4.17.21</a>.</p>
  <p><a href="https://i.stack.imgur.com/qQi64.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qQi64.png" alt="enter image description here" /></a></p>
  <p>#######</p>
  <p>This seems to be the interface member that the TypeScript compiler is barking about... however, I'm not calling it anywhere on my code.</p>
  <p><a href="https://i.stack.imgur.com/yaARp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yaARp.png" alt="enter image description here" /></a></p>