Search code examples
typescript

tsc: The term 'tsc' is not recognized as a name of a cmdlet, function, script file, or executable program for configuring TypeScript Program


I got an error while configuring TypeScript Program.

tsc: The term 'tsc' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Solution

  • Typescript might not be installed globally for a reason, so do so.

    npm install -g typescript // install globally
    

    If you want to convert .ts files into .js, do this as per your need

    tsc path/file.ts // file.ts will be converted to file.js
    tsc              // all .ts files will be converted to .js files with in the directory
    tsc --watch      // converts all .ts files to .js, and watch changes in .ts files