# AssemblyScript

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/AssemblyScript
> Markdown URL: https://mediated.wiki/source/AssemblyScript.md
> Source: https://en.wikipedia.org/wiki/AssemblyScript
> Source revision: 1345002989
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

TypeScript-based programming language

AssemblyScript Paradigms Multi-paradigm: functional, generic, imperative, object-oriented Family ECMAScript: JavaScript: TypeScript Designed by Daniel Wirtz,[1] Max Graey[2] Developer The AssemblyScript Project[1] First appeared 2017; 9 years ago (2017)[3] Stable release 0.28.19[4] / 12 June 2026; 13 days ago (12 June 2026) Typing discipline Static Scope Lexical License Apache 2.0[5] Filename extensions .ts File formats text, Unicode (source) .wasm binary format (object) Website www.assemblyscript.org Major implementations asc (AssemblyScript compiler) Influenced by JavaScript, TypeScript, WebAssembly

**AssemblyScript** is a [TypeScript](/source/TypeScript)-based [programming language](/source/Programming_language) that is optimized for, and statically [compiled](/source/Compiler) to, [WebAssembly](/source/WebAssembly) (currently using asc, the reference AssemblyScript compiler). Resembling [ECMAScript](/source/ECMAScript) and [JavaScript](/source/JavaScript), but with static [data types](/source/Data_type), the language is developed by the AssemblyScript Project[6] with contributions from the AssemblyScript community.

## Overview

In 2017, the availability of support for [WebAssembly](/source/WebAssembly), a standard definition for a [low-level](/source/Low-level_programming_language) [bytecode](/source/Bytecode) and an associated [virtual machine](/source/Virtual_machine), became widespread among major [web browsers](/source/Web_browser), providing web programs a lower-level and potentially higher-performance compiling target for [client-side](/source/Client-side) programs and applications to execute within web browsers, along with the [interpreted](/source/Interpreter_(computing)) (and in practice [dynamically compiled](/source/Just-in-time_compilation)) [JavaScript](/source/JavaScript) web scripting language.[7] WebAssembly allows programs and code to be [statically compiled](/source/Ahead-of-time_compilation) ahead of time in order to run at potentially native-level or *[bare machine](/source/Bare_machine)* (metal) performance within web browsers, without the overhead of interpretation or the initial latency of [dynamic compilation](/source/Dynamic_compilation).[8]

With the adoption of WebAssembly in major web browsers, Alon Zakai, creator of [Emscripten](/source/Emscripten), an [LLVM](/source/LLVM)–[Clang](/source/Clang)-based [C](/source/C_(programming_language)) and [C++](/source/C%2B%2B) compiler that targeted a subset of [JavaScript](/source/JavaScript) named [asm.js](/source/Asm.js), added support for WebAssembly as a compiling target in Emscripten, allowing C and/or C++ programs and code to be compiled directly to WebAssembly.[9]

While Emscripten and similar compilers allow writing new code, or [porting](/source/Porting) extant code, written in a [high-level programming language](/source/High-level_programming_language) such as C, C++, [Go](/source/Go_(programming_language)), and [Rust](/source/Rust_(programming_language)) to WebAssembly to achieve potentially higher, native-level execution performance in web browsers, this forces web developers accustomed to developing client-side web scripts and applications in ECMAScript–JavaScript (the *de facto* client-side programming language in web browsers) to use a different language to target WebAssembly than JavaScript. AssemblyScript, as a variant of TypeScript that is syntactically similar to JavaScript, allows developers accustomed to JavaScript to use a familiar language to target WebAssembly, potentially reducing the learning curve of a separate language that can be compiled to WebAssembly. Also, because AssemblyScript was designed to be an optimal source language for WebAssembly, the language's [type system](/source/Type_system) closely reflects that of WebAssembly,[10] and the language provides standard low-level functions (typically implemented as [macros](/source/Macro_(computer_science)#Assembly_language)) that map directly to WebAssembly instructions that mirror instructions available on modern processors such as [single instruction, multiple data](/source/Single_instruction%2C_multiple_data) (SIMD) and [vector](/source/Vector_processor) instructions and more specialized instructions such as clz (count leading zero bits), ctz (count trailing zero bits), and popcnt ([population count](/source/Hamming_weight)), used in applications such as encryption and cryptographic libraries.[11]

asc, the reference AssemblyScript compiler, is based on Binaryen [[d](https://www.wikidata.org/wiki/Special:EntityPage/Q131308722)], a back-end compiler [toolchain](/source/Toolchain) developed by Alon Zakai that compiles to WebAssembly and is a component of [Emscripten](/source/Emscripten) (which Zakai also developed). The asc compiler and other tooling are available via the [npm](/source/Npm_(software)) package manager.

While WebAssembly was originally designed for execution within web browsers, the development of WASI (WebAssembly System Interface), a community specification for a standard [API](/source/API) that allows WebAssembly programs access to [system calls](/source/System_call) and other [operating system](/source/Operating_system) functions,[12] has led to the development of WebAssembly [runtime](/source/Runtime_system) environments from projects such as [Wasmtime](https://en.wikipedia.org/w/index.php?title=Wasmtime&action=edit&redlink=1) [[d](https://www.wikidata.org/wiki/Special:EntityPage/Q119398768)],[13] [WebAssembly Micro Runtime](https://en.wikipedia.org/w/index.php?title=WebAssembly_Micro_Runtime&action=edit&redlink=1) [[d](https://www.wikidata.org/wiki/Special:EntityPage/Q123167983)], [Wasmer](https://en.wikipedia.org/w/index.php?title=Wasmer&action=edit&redlink=1) [[d](https://www.wikidata.org/wiki/Special:EntityPage/Q105554548)],[14] [WasmEdge](https://en.wikipedia.org/w/index.php?title=WasmEdge&action=edit&redlink=1) [[d](https://www.wikidata.org/wiki/Special:EntityPage/Q138773858)] and [wazero](https://en.wikipedia.org/w/index.php?title=Wazero&action=edit&redlink=1) [[d](https://www.wikidata.org/wiki/Special:EntityPage/Q138773029)] that allow WebAssembly, and code written in languages such as AssemblyScript that can compile to it, to run in non-web environments as well.[15]

## Compatibility with JavaScript

AssemblyScript is compiled to WebAssembly modules, which can then be instantiated into client-side Web pages using standard JavaScript methods such as WebAssembly.compileStreaming and WebAssembly.instantiateStreaming just like standard WebAssembly binaries.[16] Data passing between JavaScript and the compiled WebAssembly modules, as well as function calls between JavaScript and WebAssembly, are then the same as for any WebAssembly module.[17]

Because the AssemblyScript language is mostly a subset of TypeScript, it is theoretically possible to write an AssemblyScript program using this subset and compile it to both plain JavaScript and WebAssembly, using the TypeScript compiler and AssemblyScript compiler, respectively. This potentially allows [portable code](/source/Software_portability) that can be used in either JavaScript or WebAssembly [runtime systems](/source/Runtime_system) (environments).

## Use

As of May 2025[\[update\]](https://en.wikipedia.org/w/index.php?title=AssemblyScript&action=edit), more than 29,000 projects hosted on [GitHub](/source/GitHub) are written, either wholly or partly, in AssemblyScript,[18] with roughly 50,000 downloads of the AssemblyScript compiler per week via [npm](/source/Npm_(software)).[19][20]

In 2021, [Webpack](/source/Webpack) started using AssemblyScript to speed calculation of hash functions such as xxhash and md4 [sources](https://github.com/webpack/webpack/tree/main/assembly/hash). This also made it possible to remove native dependencies.

## Reception

Lead Emscripten developer Alon Zakai has characterized AssemblyScript as being "designed with WebAssembly and code size in mind. It's not an existing language that we are using for a new purpose, but it's a language designed for WebAssembly. It has great wasm-opt integration—in fact, it's built with it—and it's very easy to get good code size."[21]

Norwegian musician Peter Salomonsen, in a 2020 WebAssembly Summit talk titled, "WebAssembly Music," demonstrated the use of AssemblyScript for real-time compiling to WebAssembly in live electronic music synthesis, saying, "I chose AssemblyScript because it has high-level readability and low-level control; it's like a high-level language, but you get that low-level feeling, and you can even write direct WebAssembly intrinsics if you want to."[22]

Aaron Turner, a senior engineer at [Fastly](/source/Fastly), a cloud computing services provider that uses WebAssembly for the company's Compute@Edge serverless compute environment, in a review of AssemblyScript wrote:[23]

While AssemblyScript requires stricter typing than TypeScript does, it sticks as close as possible to TypeScript syntax and semantics—which means that most JavaScript developers will find AssemblyScript comfortable to use—and it enables great support for the modern JavaScript ecosystem. For instance, the AssemblyScript compiler is available on npm, as well as common AssemblyScript tools and libraries like as-pect. AssemblyScript files also use TypeScript's ‘.ts’ file extension, and it includes proper typings for allowing AssemblyScript to piggy-back on TypeScript tooling, such as the TypeScript linter. With the right small tweaks, AssemblyScript can even be used with the TypeScript compiler.

This is useful, as AssemblyScript offers a low-overhead entry-point for JavaScript developers to pick up a language to output WebAssembly—both in terms of learning to read and write AssemblyScript, and using much extant tooling that may already be in a JavaScript developer's workflow. AssemblyScript is often referred to in the WebAssembly community as a great gateway to picking up WebAssembly. It offers a large group of developers who already write applications for the web a path to pick up and learn WebAssembly. Even if you are starting from scratch and are not particularly familiar with JavaScript or TypeScript, AssemblyScript is a solid choice when picking a language to start outputting WebAssembly.

However, Turner went on to cite the language's relative newness and thus its lack of some features available in larger, more complex and established programming languages as potential but temporary shortcomings of the language.

## See also

- [Free and open-source software portal](https://en.wikipedia.org/wiki/Portal:Free_and_open-source_software)

- [Emscripten](/source/Emscripten)

- [JavaScript](/source/JavaScript)

- [TypeScript](/source/TypeScript)

- [WebAssembly](/source/WebAssembly)

## References

1. ^ [***a***](#cite_ref-as-wg_1-0) [***b***](#cite_ref-as-wg_1-1) ["AssemblyScript Working Group"](https://github.com/AssemblyScript/working-group). *GitHub.com*. AssemblyScript Project. April 24, 2020. Retrieved February 10, 2021. Daniel Wirtz (@dcodeIO) - Author of AssemblyScript

1. **[^](#cite_ref-2)** Turner, Aaron (March 28, 2019). ["WebAssembly for Javascript Developers"](https://www.youtube.com/watch?v=ZlL1nduatZQ). *YouTube.com*. WebAssembly SF. Retrieved February 10, 2021. @dcodeIO [Daniel Wirtz] and @MaxGraey [Max Graey]—they're the main two developers of AssemblyScript

1. **[^](#cite_ref-3)** ["assemblyscript 0.1.0"](https://www.npmjs.com/package/assemblyscript/v/0.1.0). *npmjs.com*. AssemblyScript Project. 2017. Retrieved February 10, 2021.

1. **[^](#cite_ref-wikidata-1f5d2165eb62d174621ccbae76f5d404964142f2-v20_4-0)** ["Release 0.28.19"](https://github.com/AssemblyScript/assemblyscript/releases/tag/v0.28.19). June 12, 2026. Retrieved June 13, 2026.

1. **[^](#cite_ref-5)** ["License"](https://github.com/AssemblyScript/assemblyscript/blob/master/LICENSE). *GitHub.com*. The AssemblyScript Project. September 29, 2017. Retrieved February 10, 2021. AssemblyScript/assemblyscript is licensed under the Apache License 2.0

1. **[^](#cite_ref-github_6-0)** ["The AssemblyScript Project"](https://github.com/AssemblyScript). *GitHub.com*. The AssemblyScript Project. Retrieved February 10, 2021.

1. **[^](#cite_ref-7)** ["Roadmap"](https://webassembly.org/roadmap/). *WebAssembly.org*. WebAssembly Community Group. November 2017. Retrieved February 10, 2021.

1. **[^](#cite_ref-8)** WebAssembly Working Group. ["WebAssembly"](https://webassembly.org/). *WebAssembly.org*. WebAssembly Working Group. Retrieved February 10, 2021.

1. **[^](#cite_ref-9)** Zakai, Alon; Others. ["Emscripten"](https://emscripten.org/). *Emscripten.org*. Emscripten project. Retrieved February 10, 2021.

1. **[^](#cite_ref-10)** ["Types"](https://www.assemblyscript.org/types.html). *AssemblyScript.org*. The AssemblyScript Project. Retrieved February 10, 2021.

1. **[^](#cite_ref-11)** ["Environment"](https://www.assemblyscript.org/environment.html). *AssemblyScript.org*. The AssemblyScript Project. Retrieved February 10, 2012.

1. **[^](#cite_ref-12)** The Wasmtime Project. ["WASI: The WebAssembly System Interface"](https://wasi.dev/). *WASI.dev*. The Wasmtime Project. Retrieved February 10, 2021.

1. **[^](#cite_ref-13)** The Wasmtime Project. ["Wasmtime: A small and efficient runtime for WebAssembly & WASI"](https://wasmtime.dev/). *Wasmtime.dev*. The Wasmtime Project. Retrieved February 10, 2021.

1. **[^](#cite_ref-14)** Wasmer, Inc. ["Wasmer: The Universal WebAssembly Runtime"](https://wasmer.io/). *Wasmer.io*. Wasmer, Inc. Retrieved February 10, 2021.

1. **[^](#cite_ref-15)** Jaghori, Sasan (August 1, 2023). [*Efficient Serverless Computing with WebAssembly*](https://resolver.obvsg.at/urn:nbn:at:at-fhcw:1-104668) (Master thesis). University of Applied Sciences Campus Vienna.

1. **[^](#cite_ref-16)** Mozilla Developer Network. ["Loading and running WebAssembly code"](https://developer.mozilla.org/en-US/docs/WebAssembly/Loading_and_running). *developer.mozilla.org*. Mozilla Developer Network. Retrieved February 10, 2021.

1. **[^](#cite_ref-17)** Mozilla Developer Network. ["Using the WebAssembly JavaScript API"](https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API). *developer.mozilla.org*. Mozilla Developer Network. Retrieved February 10, 2021.

1. **[^](#cite_ref-18)** ["AssemblyScript/assemblyscript Dependency graph"](https://github.com/AssemblyScript/assemblyscript/network/dependents?package_id=UGFja2FnZS0xODY0NzM4NQ%3D%3D). *GitHub.com*. [GitHub](/source/GitHub). Retrieved May 26, 2025.

1. **[^](#cite_ref-19)** npmjs. ["assemblyscript Weekly Downloads"](https://www.npmjs.com/package/assemblyscript). *npmjs.com*. Retrieved May 26, 2025.

1. **[^](#cite_ref-20)** ["Resolve Error In Typescript"](https://ittutoria.net/resolve-error-in-typescript-object-is-possibly-undefined/). June 3, 2022. Saturday, 7 May 2022

1. **[^](#cite_ref-21)** Alon Zakai (February 19, 2020). ["Shipping Tiny WebAssembly Builds"](https://www.youtube.com/watch?v=_lLqZR4ufSI). *YouTube.com*. WebAssembly-Summit.org. Retrieved February 10, 2021.

1. **[^](#cite_ref-22)** Peter Salomonsen (February 19, 2020). ["WebAssembly Music"](https://www.youtube.com/watch?v=C8j_ieOm4vE). *YouTube.com*. WebAssembly-Summit.org. Retrieved February 10, 2021.

1. **[^](#cite_ref-23)** Aaron Turner (October 29, 2020). ["Meet AssemblyScript: your next computing language"](https://www.fastly.com/blog/meet-assemblyscript-your-next-computing-language). *Fastly.com*. [Fastly](/source/Fastly). Retrieved February 10, 2021.

## External links

- [Official website](http://www.assemblyscript.org)

- [AssemblyScript](https://github.com/AssemblyScript) on [GitHub](/source/GitHub)

- [AssemblyScript documentation](https://www.assemblyscript.org/introduction.html) (project page)

- [assemblyscript](https://www.npmjs.com/package/assemblyscript) (on [npm](/source/Npm_(software)))

v t e JavaScript Code analysis ESLint JSHint JSLint Subsets,* supersets JS++ Source* TypeScript (ArkTS) Transpilers AtScript Babel ClojureScript CoffeeScript Dart Elm Emscripten Google Closure Compiler Google Web Toolkit Haxe LiveScript Morfik Nim Opa PureScript ReScript WebSharper Concepts JavaScript library JavaScript syntax Debuggers Chrome DevTools Firefox Inspector (formerly Firebug) Komodo IDE Safari Web Inspector Documentation generators JSDoc Editors (comparison) Ace Cloud9 IDE Atom CodeMirror Brackets Light Table PhpStorm Orion Visual Studio Visual Studio Express Visual Studio Code Visual Studio Team Services Vim Engines List of JavaScript engines Frameworks Comparison of JavaScript frameworks List of JavaScript libraries Related technologies Ajax AssemblyScript asm.js CSS DOM HTML HTML5 JSON WebAssembly WebAuthn Package managers npm pnpm yarn Bun Module bundlers Bun esbuild Vite Webpack Server-side Active Server Pages Bun CommonJS Deno JSGI Node.js Unit testing frameworks (list) Jasmine Mocha QUnit People Douglas Crockford Ryan Dahl Brendan Eich John Resig Jesse James Garrett Outline Index Wikibook

v t e ECMAScript Dialects ActionScript Haxe Bosque Caja JavaScript engines asm.js JS++ JScript JScript .NET QtScript Solidity TypeScript WMLScript Engines Carakan Futhark JavaScriptCore JScript KJS Linear B QtScript Rhino SpiderMonkey TraceMonkey JägerMonkey Tamarin V8 ChakraCore Chakra JScript .NET Nashorn Frameworks Client-side Dojo Echo Ext JS Google Web Toolkit jQuery Lively Kernel midori MochiKit MooTools Prototype qooxdoo SproutCore Spry Wakanda Framework Server-side Node.js Deno Bun GraalJS Jaxer AppJet WakandaDB Multiple Cappuccino Libraries Backbone.js SWFObject Underscore.js People Brendan Eich Douglas Crockford John Resig Scott Isaacs Other DHTML Ecma International JSDoc JSGI JSHint JSLint JSON JSSS Sputnik SunSpider Asynchronous module definition CommonJS Lists: JavaScript libraries • Ajax frameworks • Server-side JavaScript Comparison: JavaScript web frameworks

v t e Programming languages Comparison Timeline History Ada ALGOL Simula APL Assembly BASIC Visual Basic classic .NET C C++ C# COBOL Erlang Elixir Forth Fortran Go Haskell Java JavaScript Julia Kotlin Lisp Lua MATLAB ML Caml OCaml Standard ML Pascal Object Pascal Perl Raku PHP Prolog Python R Ruby Rust SAS SQL Scratch Shell Smalltalk Swift more... Lists: Alphabetical Categorical Generational Non-English-based Category

---
Adapted from the Wikipedia article [AssemblyScript](https://en.wikipedia.org/wiki/AssemblyScript) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/AssemblyScript?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
