AssemblyScript Documentation

website·Indexed Apr 12, 2026

https://www.assemblyscript.org/introduction.html

The AssemblyScript Book introduces AssemblyScript, a TypeScript variant that compiles to WebAssembly using Binaryen. This documentation covers the asc compiler, core concepts like strict typing and sandboxed execution, and the standard library including Array, ArrayBuffer, crypto, and Math modules. It provides examples for low-level WebAssembly capabilities, runtime memory management, and tooling integration. The guide also details implementation status, standards objections, and frequently asked questions regarding performance and feature support.

Tokens
5.7K
Snippets
19
Records
71
Agent score
50%

What's inside AssemblyScript

  1. What is AssemblyScript

    AssemblyScript is a TypeScript variant that compiles to WebAssembly using Binaryen. It provides WebAssembly types and strict ahead-of-time compilation while maintaining close similarity to TypeScript/JavaScript. This makes it familiar for web developers while offering low-level control over WebAssembly instructions and memory.
  2. Heap module overview

    The heap module provides an unsafe interface for direct dynamic memory management in AssemblyScript. It offers functions similar to C's malloc, realloc, and free. Manual memory management can be used in parallel with garbage collection, but manually managed blocks cannot be mixed with garbage collected objects—attempting to heap.free a GC object or casting a managed block to a manual block will break because they have incompatible internal headers.
  3. StaticArray overview

    StaticArray is a randomly accessible sequence of values of a generic type with a fixed length. Unlike a normal Array, StaticArray has a fixed length that cannot change and no separate backing buffer, eliminating level of indirection. This provides minimal overhead and performance characteristics similar to arrays in C. The API is similar to the Array API.
  4. AssemblyScript ecosystem position on WebAssembly and the Open Web Platform

    AssemblyScript believes the WebAssembly ecosystem would benefit from compatibility with the existing Web platform while fostering open collaboration without harassment. They see negative value in technology that has been "taken over by politics" while ignoring technical concerns. They argue that use cases fitting the Web platform are artificially disadvantaged while other languages are irrationally advantaged, and that purpose and values of open Web standards are not being honored.
  5. Math module variants and defaults

    AssemblyScript provides three Math variants: NativeMath (WebAssembly f64), NativeMathf (WebAssembly f32), and JSMath (JavaScript f64 imported from host). By default, Math maps to NativeMath and Mathf maps to NativeMathf. Use JSMath when module size is more important than performance.
  6. Game of Life example overview

    This example demonstrates Conway's Game of Life implemented in AssemblyScript with canvas visualization. It covers: exporting functions from WebAssembly, calling WebAssembly from JavaScript, importing JS configuration values, using --importMemory for shared memory, @inline for performance, --use Math=JSMath to reduce module size, handling user input via direct buffer modification, and understanding WebAssembly's little-endian byte order.
  7. Error API overview

    AssemblyScript provides an Error API that mirrors JavaScript's global Error object, with some properties not yet implemented. The API includes the base Error class plus three variants for specific error types.
  8. AssemblyScript concerns about the Bytecode Alliance

    AssemblyScript expresses skepticism about the Bytecode Alliance, citing concerns about: selective empowerment of players in the WebAssembly space, questionable process values like "disagree and commit" that can override technical values, operations beyond stated social values of collaboration and openness, and potential anti-competitive practices. AssemblyScript notes that not all members may be aware of or approve of these actions, but believes WebAssembly would be better off without the Bytecode Alliance.
  9. Wasm By Example

    External resource for learning more about WebAssembly concepts beyond AssemblyScript documentation.
  10. Symbol primitive data type

    AssemblyScript provides a symbol primitive data type representing unique global symbols, similar to JavaScript's Symbol (MDN). Symbols are primitive data types that represent unique values and can be used as object property keys. Note that AssemblyScript's symbol is not yet deeply integrated with the compiler.