TypeScript
TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale. GenAIScript scripts can be authored in TypeScript.
From JavaScript to TypeScript
You can convert any existing script to typescript by changing the file name extension to .genai.mts
.
Importing TypeScript source files
It is possible to import TypeScript source file using dynamic imports.
- dynamic import (
async import(...)
)
Does GenAIScript type-check prompts?
No.
GenAIScript converts TypeScript to JavaScript without type checks through tsx.
Most modern editors, like Visual Studio Code, will automatically type-check TypeScript sources.