v0.10 release candidate · open source

Write Solana programs
in TypeScript.

TypeSOL compiles a TypeScript subset to native SBF with Anchor-compatible IDLs.

git clone https://github.com/typesol/typesol.git
import { type Account, type Init, type Mut, type Pubkey, type Signer, type SystemProgram, type u8, type u64, require } from "typesol"; export interface Counter {  authority: Pubkey;  count: u64;  bump: u8;} export enum CounterError {  Unauthorized = "Only the counter's authority can change it",} /** Create the caller's counter at PDA ["counter", authority]. */export function initialize(authority: Mut<Signer>, counter: Init<Counter>, systemProgram: SystemProgram): void {  counter.bump = counter.create(authority, ["counter", authority.key]);  counter.authority = authority.key;  counter.count = 0n;} export function increment(authority: Signer, counter: Mut<Counter>, by: u64): void {  require(counter.authority === authority.key, CounterError.Unauthorized);  counter.count += by;} /** Read-only check that callers can simulate. */export function assertAtLeast(counter: Account<Counter>, min: u64): void {  require(counter.count >= min, "counter is below the expected minimum");} 
29 lines

Measured against Anchor, native Rust and Pinocchio

Compute units (counter.increment)
  • 143TypeSOL
  • 857Native Rust
  • 2,323Anchor
  • 113Pinocchio
Program size (counter.so)
  • 12.3 KBTypeSOL
  • 145.2 KBAnchor
Tests

310

tests passed

License

MIT

open source

The same programs, four ways

Counter and vault written in TypeSOL, Anchor, native Rust and Pinocchio, with the same instructions, the same account layout and identical final state. The table gives mean compute units in LiteSVM; lower is better. TypeSOL matches or beats hand-tuned Pinocchio on 4 of 6; Pinocchio is still faster on counter.increment and vault.shut.

counter.initialize

  • TypeSOL3,048
  • Native Rust4,601
  • Anchor6,573
  • Pinocchio3,186

counter.increment

  • TypeSOL143
  • Native Rust857
  • Anchor2,323
  • Pinocchio113

vault.open

  • TypeSOL3,062
  • Native Rust4,613
  • Anchor6,627
  • Pinocchio3,185

vault.deposit

  • TypeSOL1,358
  • Native Rust2,832
  • Anchor4,355
  • Pinocchio1,377

vault.withdraw

  • TypeSOL352
  • Native Rust1,176
  • Anchor3,628
  • Pinocchio370

vault.shut

  • TypeSOL201
  • Native Rust950
  • Anchor2,024
  • Pinocchio167
Binary size, KB
ProgramTypeSOLNative RustAnchorPinocchio
counter.so12.327.9145.219.6
vault.so16.135.0158.922.9

Fewer compute units are not a safety claim. Two programs are compared so far; more will be added as the benchmark suite grows.

No interpreter. No generated Rust.

Your .ts file becomes a native Solana program in five steps, on your machine.

  1. Typecheck

    The TypeScript compiler checks your file against the TypeSOL declarations. Your editor already understands it.

    counter.ts
  2. Subset check

    Anything outside the language, such as floats, closures or classes, is a file:line:col error, never half-supported.

    0 errors
  3. Lower to C

    Account checks, checked arithmetic, Borsh and CPIs come from a small C runtime.

    counter.c
  4. Build SBF

    The same LLVM toolchain cargo-build-sbf uses links the program. Builds are reproducible.

    counter.so · 12.3 KB
  5. Emit the IDL

    An Anchor-compatible IDL, so Anchor clients, Codama and explorers work unchanged.

    counter.json · spec 0.1.0

TypeSOL $TS

Supports TypeSOL development: audits and infrastructure.

Chain
Solana
Launch
Meteora DBC · SOL pair
Status
Pre-launch
Contract
Published here at launch

Only trust the contract address published on this page and in the GitHub repository. Nothing here is financial advice.

Built in public

The big milestones. Everything smaller lands in the changelog.

  1. Compiler 0.10Shipped
  2. AI-nativeNext
  3. Client SDKPlanned
  4. Verified buildsPlanned
  5. PlaygroundPlanned
  6. Audit & 1.0Planned