Why is our Angular application no longer building when using the latest Windows VM Agent

Dirk Vrancken 21 Reputation points
2025-06-18T12:08:10.2033333+00:00

Since today 18/6/2025 we are no longer able to build our Angular application. This was working friday 13/6/2025. We are getting for instance following error message:

2025-06-18T11:51:54.6119702Z Error: src/app/reports/edit-add-checklist-report/step4/checklist-report-step4.component.ts:113:17 - error TS2345: Argument of type 'RecipientContactOptionDto[]' is not assignable to parameter of type 'never'.

2025-06-18T11:51:54.6120011Z

2025-06-18T11:51:54.6120315Z 113 _remove(this.recipients, (r) => r.id === recipient.id && r.recipientType == recipient.recipientType);

2025-06-18T11:51:54.6120768Z ~~~~~~~~~~~~~~~

What has been changed in the Windows Hosted VM Agent?

Azure DevOps
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Durga Reshma Malthi 4,430 Reputation points Microsoft External Staff Moderator
    2025-06-18T12:45:05.4566667+00:00

    Hi Dirk Vrancken

    Azure DevOps deprecated the Windows Server 2019 hosted agent (windows-2019) starting June 1, with full removal by June 30. If your pipeline didn't explicitly specify a newer image, it likely started using Windows Server 2022 or 2025, which ship with a newer TypeScript version installed globally in the build image.

    Could you please follow the below steps to resolve this issue:

    1. You can resolve this by explicitly typing this.recipients: recipients: RecipientContactOptionDto[] = []; Or, cast it inline: _remove(this.recipients as RecipientContactOptionDto[], (r) => ...)
    2. Alternatively, disable strict inference for that line using a type assertion:
      _remove(this.recipients as any, (r) => ...)

    Additional References:

    https://devblogs.microsoft.com/devops/upcoming-updates-for-azure-pipelines-agents-images/?utm_source=chatgpt.com

    Hope this helps!

    Please Let me know if you have any queries.

    0 comments No comments

  2. Dirk Vrancken 21 Reputation points
    2025-06-18T13:20:57.3033333+00:00

    We are using "windows-latest" already a long time. We prefer not to update our code, because it is used in a lot of locations. Last friday the build was ok. Today suddenly it fails. From the logfiles we see that each time the same buildnummer is used : Microsoft Windows Server 2022 (10.0.20348)

    0 comments No comments

  3. Durga Reshma Malthi 4,430 Reputation points Microsoft External Staff Moderator
    2025-06-18T13:27:59.9066667+00:00

    Hi Dirk Vrancken

    Even though the build number still shows Microsoft Windows Server 2022 (10.0.20348), Microsoft has likely refreshed the windows-latest image with updated tooling—especially TypeScript, Node.js, or Angular CLI versions—which can silently introduce breaking changes without altering the OS version string.

    In your yaml file, explicitly set the version that worked last week:

    - script: |
        npm install typescript@4.8.4 --save-dev
        npm run build
      displayName: 'Install specific TS and build'
    

    Instead of windows-latest, switch to a pinned image like:

    pool:
      vmImage: 'windows-2022'
    

    If your build depends on specific Node.js or Python versions, explicitly install them in the pipeline to override the agent defaults - Use UseNode@1 and UsePython@1 Tasks

    Hope this helps!

    Please Let me know if you have any queries.

    0 comments No comments

  4. Dirk Vrancken 21 Reputation points
    2025-06-18T14:48:39.2133333+00:00

    Hi Durga Reshma Malthi,

    We tried your suggestions, but still we have the same issue. Any other suggestions?

    Kind regards,

    Dirk

    0 comments No comments

  5. Durga Reshma Malthi 4,430 Reputation points Microsoft External Staff Moderator
    2025-06-18T16:13:05.45+00:00

    Hi Dirk Vrancken

    Please try the below steps individually.

    1. In your package.json, explicitly set the version that worked last week:
         "devDependencies": {
           "typescript": "4.9.5"
         }
      
      Then run:
         npm install
      
    2. Explicitly install your desired TypeScript version in the pipeline:
         - script: |
             npm install typescript@4.9.5 --save-dev
             npx tsc --version
           displayName: 'Install and verify TypeScript version'
      
      Use npx to run Angular CLI so it uses your local TypeScript:
         - script: |
             npx ng build --configuration production
           displayName: 'Build Angular App'
      
      This ensures the build uses the locally installed TypeScript, not the one preinstalled on the agent.
    3. Add these steps before your build:
         - task: NodeTool@0
           inputs:
             versionSpec: '16.x'  # or your preferred Node version
           displayName: 'Use Node 16.x'
         - script: |
             npm ci
             npm install typescript@4.8.4 --save-dev
           displayName: 'Install specific TS version'
         - script: npm run build
           displayName: 'Build with fixed TS'
      
    4. Explicitly Pin Node Version: The Node runtime could also impact how TS behaves. Use the NodeTool task to match what was working before:
         - task: NodeTool@0
           inputs:
             versionSpec: '14.x'
           displayName: 'Use Node 14.x'
      
    5. Add engines and engine-strict in package.json
         "engines": {
           "node": ">=14 <15",
           "typescript": "4.8.4"
         },
         "engineStrict": true
      
      Then run:
         npm config set engine-strict true
      
      Errors will surface early if versions drift.
    6. Instead of windows-latest, switch to a pinned image like:
         pool:
           vmImage: 'ubuntu-latest'
      

    Additional References:

    https://developercommunity.visualstudio.com/t/azure-pipeline-for-angular-issue/583254

    Hope this helps!

    Please Let me know if you have any queries.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.