Invoking the TypeScript Compiler from PowerShell

Topics: General
Oct 4, 2012 at 12:15 AM

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 7:10 AM

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

Oct 4, 2012 at 2:17 PM

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