@@ -1543,6 +1543,37 @@ declare namespace WebAssembly {
15431543 ( message ?: string ) : CompileError ;
15441544 } ;
15451545
1546+ /**
1547+ * The **`WebAssembly.Exception`** object represents a runtime exception thrown from WebAssembly to JavaScript, or thrown from JavaScript to a WebAssembly exception handler.
1548+ *
1549+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception)
1550+ */
1551+ interface Exception {
1552+ /**
1553+ * The read-only **`stack`** property of an object instance of type WebAssembly.Exception may contain a stack trace.
1554+ *
1555+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/stack)
1556+ */
1557+ readonly stack : string | undefined ;
1558+ /**
1559+ * The **`getArg()`** prototype method of the Exception object can be used to get the value of a specified item in the exception's data arguments.
1560+ *
1561+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/getArg)
1562+ */
1563+ getArg ( index : number ) : any ;
1564+ /**
1565+ * The **`is()`** prototype method of the Exception object can be used to test if the Exception matches a given tag.
1566+ *
1567+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Exception/is)
1568+ */
1569+ is ( exceptionTag : Tag ) : boolean ;
1570+ }
1571+
1572+ var Exception : {
1573+ prototype : Exception ;
1574+ new ( exceptionTag : Tag , payload : any [ ] , options ?: ExceptionOptions ) : Exception ;
1575+ } ;
1576+
15461577 /**
15471578 * A **`WebAssembly.Global`** object represents a global variable instance, accessible from both JavaScript and importable/exportable across one or more WebAssembly.Module instances. This allows dynamic linking of multiple modules.
15481579 *
@@ -1603,7 +1634,7 @@ declare namespace WebAssembly {
16031634 *
16041635 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Memory/grow)
16051636 */
1606- grow ( delta : number ) : number ;
1637+ grow ( delta : AddressValue ) : AddressValue ;
16071638 }
16081639
16091640 var Memory : {
@@ -1621,7 +1652,7 @@ declare namespace WebAssembly {
16211652
16221653 var Module : {
16231654 prototype : Module ;
1624- new ( bytes : BufferSource ) : Module ;
1655+ new ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Module ;
16251656 /**
16261657 * The WebAssembly.**`Module.customSections()`** static method returns a copy of the contents of all custom sections in the given module with the given string name.
16271658 *
@@ -1662,40 +1693,58 @@ declare namespace WebAssembly {
16621693 *
16631694 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/length)
16641695 */
1665- readonly length : number ;
1696+ readonly length : AddressValue ;
16661697 /**
16671698 * The **`get()`** prototype method of the WebAssembly.Table() object retrieves the element stored at a given index.
16681699 *
16691700 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/get)
16701701 */
1671- get ( index : number ) : any ;
1702+ get ( index : AddressValue ) : any ;
16721703 /**
16731704 * The **`grow()`** prototype method of the WebAssembly.Table object increases the size of the Table instance by a specified number of elements, filled with the provided value.
16741705 *
16751706 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/grow)
16761707 */
1677- grow ( delta : number , value ?: any ) : number ;
1708+ grow ( delta : AddressValue , value ?: any ) : AddressValue ;
16781709 /**
16791710 * The **`set()`** prototype method of the WebAssembly.Table object mutates a reference stored at a given index to a different value.
16801711 *
16811712 * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Table/set)
16821713 */
1683- set ( index : number , value ?: any ) : void ;
1714+ set ( index : AddressValue , value ?: any ) : void ;
16841715 }
16851716
16861717 var Table : {
16871718 prototype : Table ;
16881719 new ( descriptor : TableDescriptor , value ?: any ) : Table ;
16891720 } ;
16901721
1722+ /**
1723+ * The **`WebAssembly.Tag`** object defines a type of a WebAssembly exception that can be thrown to/from WebAssembly code.
1724+ *
1725+ * [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/Tag)
1726+ */
1727+ interface Tag {
1728+ }
1729+
1730+ var Tag : {
1731+ prototype : Tag ;
1732+ new ( type : TagType ) : Tag ;
1733+ } ;
1734+
1735+ interface ExceptionOptions {
1736+ traceStack ?: boolean ;
1737+ }
1738+
16911739 interface GlobalDescriptor < T extends ValueType = ValueType > {
16921740 mutable ?: boolean ;
16931741 value : T ;
16941742 }
16951743
16961744 interface MemoryDescriptor {
1697- initial : number ;
1698- maximum ?: number ;
1745+ address ?: AddressType ;
1746+ initial : AddressValue ;
1747+ maximum ?: AddressValue ;
16991748 shared ?: boolean ;
17001749 }
17011750
@@ -1711,9 +1760,14 @@ declare namespace WebAssembly {
17111760 }
17121761
17131762 interface TableDescriptor {
1763+ address ?: AddressType ;
17141764 element : TableKind ;
1715- initial : number ;
1716- maximum ?: number ;
1765+ initial : AddressValue ;
1766+ maximum ?: AddressValue ;
1767+ }
1768+
1769+ interface TagType {
1770+ parameters : ValueType [ ] ;
17171771 }
17181772
17191773 interface ValueTypeMap {
@@ -1726,26 +1780,34 @@ declare namespace WebAssembly {
17261780 v128 : never ;
17271781 }
17281782
1783+ interface WebAssemblyCompileOptions {
1784+ builtins ?: string [ ] ;
1785+ importedStringConstants ?: string | null ;
1786+ }
1787+
17291788 interface WebAssemblyInstantiatedSource {
17301789 instance : Instance ;
17311790 module : Module ;
17321791 }
17331792
1734- type ImportExportKind = "function" | "global" | "memory" | "table" ;
1793+ type AddressType = "i32" | "i64" ;
1794+ type ImportExportKind = "function" | "global" | "memory" | "table" | "tag" ;
17351795 type TableKind = "anyfunc" | "externref" ;
1796+ type AddressValue = number ;
17361797 type ExportValue = Function | Global | Memory | Table ;
17371798 type Exports = Record < string , ExportValue > ;
17381799 type ImportValue = ExportValue | number ;
17391800 type Imports = Record < string , ModuleImports > ;
17401801 type ModuleImports = Record < string , ImportValue > ;
17411802 type ValueType = keyof ValueTypeMap ;
1803+ var JSTag : Tag ;
17421804 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/compile_static) */
1743- function compile ( bytes : BufferSource ) : Promise < Module > ;
1805+ function compile ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : Promise < Module > ;
17441806 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/instantiate_static) */
1745- function instantiate ( bytes : BufferSource , importObject ?: Imports ) : Promise < WebAssemblyInstantiatedSource > ;
1807+ function instantiate ( bytes : BufferSource , importObject ?: Imports , options ?: WebAssemblyCompileOptions ) : Promise < WebAssemblyInstantiatedSource > ;
17461808 function instantiate ( moduleObject : Module , importObject ?: Imports ) : Promise < Instance > ;
17471809 /** [MDN Reference](https://developer.mozilla.org/docs/WebAssembly/Reference/JavaScript_interface/validate_static) */
1748- function validate ( bytes : BufferSource ) : boolean ;
1810+ function validate ( bytes : BufferSource , options ?: WebAssemblyCompileOptions ) : boolean ;
17491811}
17501812
17511813/** The **`console`** object provides access to the debugging console (e.g., the Web console in Firefox). */
0 commit comments