Get to know MDN better
The func type definition declares a function signature: a list of parameter types and a list of result types.
A function type maps a sequence of parameter value types to a sequence of result value types. Either list may be empty.
Function types appear in three places:
Function types use structural equality: two function types are identical if and only if their parameter and result type sequences match element-for-element. The identity of the type index or the module it came from does not matter. A call_indirect will therefore succeed against a callee whose type was declared independently in another module, as long as the parameter and result sequences are the same.
The following module declares a single $bin_op type and uses it for two functions and a call_indirect site:
Calling dispatch(0, 3, 4) invokes $add and returns 7; calling dispatch(1, 3, 4) invokes $mul and returns 12. Passing an index that points to a function with a different signature traps.
| Unknown specification # syntax-functype |
This page was last modified on May 21, 2026 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.