Skip to content

if the filename doesn't end with ".wasm"

JSTime natively supports TypeScript out of the box. All files are transpiled on the fly by JSTime’s fast native transpiler before being executed. Similar to other build tools, JSTime does not perform typechecking; it simply removes type annotations from the file.

Terminal window
$ jstime index.js
$ jstime index.jsx
$ jstime index.ts
$ jstime index.tsx

Some aspects of JSTime’s runtime behavior are affected by the contents of your tsconfig.json file. Refer to Runtime > TypeScript page for details.

JSTime supports .jsx and .tsx files out of the box. JSTime’s internal transpiler converts JSX syntax into vanilla JavaScript before execution.

function Component(props: {message: string}) {
return (
<body>
<h1 style={{color: 'red'}}>{props.message}</h1>
</body>
);
}
console.log();

JSTime implements special logging for JSX to make debugging easier.

Terminal window
$ jstime run react.tsx

Text files can be imported as strings.

import text from "./text.txt";
console.log(text);
// => "Hello world!"
Hello world!

JSON and TOML files can be directly imported from a source file. The contents will be loaded and returned as a JavaScript object.

import pkg from "./package.json";
import data from "./data.toml";

🚧 Experimental

JSTime has experimental support for WASI, the WebAssembly System Interface. To run a .wasm binary with JSTime:

Terminal window
$ jstime ./my-wasm-app.wasm
# if the filename doesn't end with ".wasm"
$ jstime run ./my-wasm-app.whatever

Note — WASI support is based on wasi-js. Currently, it only supports WASI binaries that use the wasi_snapshot_preview1 or wasi_unstable APIs. JSTime’s implementation is not fully optimized for performance; this will become more of a priority as WASM grows in popularity.