Skip to content

Commit f5b8fe8

Browse files
MaxGraeyromdotdogHerrCai0907
authored
[FAQ] Add new tip about third party js npm modules (#152)
Co-authored-by: rom <70765447+romdotdog@users.noreply.github.com> Co-authored-by: Congcong Cai <congcongcai0907@163.com>
1 parent 7330d81 commit f5b8fe8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/introduction.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ TypeScript transpiles down to JavaScript, a dynamic just-in-time compiled langua
7777
It likely won't. While TypeScript adds typings to JavaScript, it is a superset after all and can describe many of JavaScript's dynamic features, not all of which are feasible to support in ahead-of-time compilation. Yet, sufficiently strict TypeScript code can often be made compatible with the AssemblyScript compiler with little effort.
7878
:::
7979

80+
::: tip Can I use any third party npm package like web.js or crypto.js?
81+
It depends. Even if the npm package has TypeScript sources that are fully compatible with AssemblyScript, bundlers / transpilers will likely compile it into regular JavaScript without proper information about the types after publishing to npm. However, you can use packages from npm that are built specifically for AssemblyScript. Some of them can be found at [Built with AssemblyScript](./built-with-assemblyscript.md). Furthermore, you can always import the necessary JavaScript methods from the host (browser or node.js) via [host bindings](./compiler.html#host-bindings).
82+
:::
83+
8084
::: tip What are good use cases for AssemblyScript?
8185
Computation-heavy logic like image manipulation, hot game logic, specialized algorithms, emulators, compilers and the likes are great use cases for WebAssembly, and as such for AssemblyScript as well. In some situations it may also be preferable to ship bytecode instead of minified JS, or just the ability to utilize a TypeScript-like language may open up new opportunities, for example for embedded scripting or plugins.
8286
:::

0 commit comments

Comments
 (0)