TypeScript Support
Sahi allows scripts to be written in TypeScript. TypeScript .ts files need to be first compiled to JS and then executed via Sahi.
Pre-requisites
Section titled “Pre-requisites”- Node.js must be installed in the system.
- TypeScript must be installed in the system.
Building TypeScript
Section titled “Building TypeScript”-
Copy
<SahiPro>/userdata/scripts/sahitests/typescript/sahi_apis.tsfile in your TypeScript workspace. -
Create
tsconfig.jsonin your workspace, if not exist and put the following contents{"compileOnSave": true,"compilerOptions": {"target": "es3","outDir": "<SahiPro>/userdata/scripts/sahitests/typescript/out"}} -
Open the TypeScript workspace in MS Code and build the project.
Go to: Tasks -> Run Build Task -> tsc:buildOr,
Open a command prompt/bash, cd to TypeScript workspace and run
tsc. -
It will build the TypeScript workspace and create JavaScript files in
<SahiPro>/userdata/scripts/sahitests/typescript/outdirectory. -
Open the JavaScript files in Sahi Pro Editor and run the script.

