If you opt for utilizing Microsoft-hosted agents to execute the pipeline, some of these MS hosted agents already come with tsc
pre-installed.
If you decide to use Self-hosted agents, it is important to ensure that you manually install tsc
on the agent machine.
If uncertainty arises regarding whether or not the agent machine contains tsc
, running the "npm install -g typescript
" command line can be used to install the latest version of tsc
.
Following these instructions, the tsc
command can then be utilized to compile your Typescript files (.ts) in Azure Pipelines.
An example is provided below for reference:
jobs:
- job: build
displayName: 'Compile TypeScript'
pool:
vmImage: windows-2022
steps:
- checkout: none
- task: Bash@3
displayName: 'Check TypeScript version'
inputs:
targetType: inline
script: |
echo "Install TypeScript:"
npm install -g typescript
echo "Check TypeScript version:"
tsc --version
- task: Bash@3
displayName: Compile TypeScript'
inputs:
targetType: inline
script: |
echo "Compile TypeScript file:"
tsc example.ts