Skip to content

TypeScript Support

Latte can be used with TypeScript and for TypeScript projects.

TypeScript TypeScript Support

To use Latte with TypeScript you need to install tsx (https://tsx.is):

Terminal window
npm install -D tsx

Change test command

package.json
{
"scripts": {
"test": "NODE_OPTIONS=\"--import tsx\" latte --ts"
}
}

Windows Windows

If you’re using Windows, we recommended to use cross-env package to set environment variables:

Terminal window
npm install -D cross-env

And then change your test command to:

package.json
{
"scripts": {
"test": "cross-env NODE_OPTIONS=\"--import tsx\" latte"
}
}