Movatterモバイル変換


[0]ホーム

URL:


Skip to content
GenAIScript
DiscordGitHubYouTubeRSS
Blog
A simple 8-bit style image shows a blue file icon marked ".mts" linked with dotted lines to two other file icons: a dark gray one representing JavaScript and a light gray one for TypeScript. All icons are arranged on a plain white background with a geometric arrow indicating import, using blue, gray, black, white, and yellow. The design is flat, highly simplified, without people or text, and measures 128 by 128 pixels.

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.

You can convert any existing script to typescript by changing the file name extension to.genai.mts.

summarizer.mts
def("FILE",files)
$`Summarize each file. Be concise.`

It is possible toimport TypeScript source file.

summarizer.mts
exportfunctionsummarize(files:string[]) {
def("FILE",files)
$`Summarize each file. Be concise.`
}
  • import
import { summarize }from"./summarizer.mts"
summarize(env.generator,env.files)

Yes and No.

Most modern editors, like Visual Studio Code, will automaticallytype-check TypeScript sources.

You can also run a TypeScript compilation using thescripts compile command.

Terminal window
genaiscriptscriptscompile

However, at runtime, GenAIScript converts TypeScript to JavaScriptwithout type checks throughtsx.


[8]ページ先頭

©2009-2025 Movatter.jp