Invoking the TypeScript Compiler from PowerShell

Topics: General
Oct 3, 2012 at 11:15 PM

Here is how you can compile a TypeScript file to JavaScript

Invoke-TSC .\helloworld.ts

This will compile and then execute the resulting JavaScript

Invoke-TSC .\helloworld.ts -Execute

Finally, you can compile and execute all the TypeScript files in a directory

dir *.ts | Invoke-TSC -Execute

Oct 4, 2012 at 6:10 AM

Why not just use the tsc command line tool that Microsoft released?

Oct 4, 2012 at 1:17 PM

This let's me plug into the PowerShell ecosystem more easily. Like using psake, leveraging PowerShelll parameter binding, piping and more.