TypeScript-Move

raw JSON →
1.1.1 verified Fri May 01 auth: no javascript

A TypeScript to Sui Move transpiler that allows developers to write Sui smart contracts using TypeScript syntax. Current stable version is 1.1.1, with active development and a v2 documentation available. It bridges the gap between web and blockchain development, enabling familiar TypeScript patterns for Move smart contracts on Sui. Key differentiators: no new language to learn, leverages TypeScript tooling, targets the Sui blockchain specifically.

error Cannot find module 'typescript-move'
cause Package not installed or ESM context missing.
fix
Run 'npm install typescript-move' and use 'import' syntax.
error TypeError: transpile is not a function
cause Using default import instead of named import.
fix
Use named import: import { transpile } from 'typescript-move'.
breaking Version 2.0 rewrites transpile API: 'compile' is replaced with 'transpile' and returns a promise.
fix Use 'transpile' from version 2.x; check docs for migration.
gotcha Only supports a subset of TypeScript; features like async/await, classes, and decorators are not supported.
fix Refer to the supported syntax documentation on the project site.
gotcha Requires Node.js >=14; no browser support.
fix Ensure Node.js version meets requirement.
deprecated The 'output' option in transpile config is deprecated; use 'format' instead.
fix Replace 'output' with 'format' in config object.
npm install typescript-move
yarn add typescript-move
pnpm add typescript-move

Transpile a simple TypeScript function to Sui Move using the transpile function.

import { transpile } from 'typescript-move';

const tsCode = `
function transfer(to: address, amount: u64) {
  balance.balanceOf(to)
}
`;

transpile(tsCode).then(result => {
  console.log(result.moveCode);
}).catch(err => {
  console.error(err);
});