@@ -10,7 +10,7 @@ import {
10
10
type Value ,
11
11
type WasmInterface ,
12
12
} from './CustomFormatters.js' ;
13
- import { type ForeignObject , type WasmValue } from './WasmTypes.js' ;
13
+ import type { ForeignObject } from './WasmTypes.js' ;
14
14
15
15
/*
16
16
* Numbers
@@ -149,8 +149,10 @@ CustomFormatters.addFormatter({
149
149
150
150
type CharArrayConstructor = typeof Uint8Array | typeof Uint16Array | typeof Uint32Array ;
151
151
function formatRawString < T extends CharArrayConstructor > (
152
- wasm : WasmInterface , value : Value , charType : T , decode : ( chars : InstanceType < T > ) => string ) : string |
153
- { [ key : string ] : Value | null } {
152
+ wasm : WasmInterface , value : Value , charType : T , decode : ( chars : InstanceType < T > ) => string ) : string | {
153
+ [ key : string ] : Value | null ,
154
+ }
155
+ {
154
156
const address = value . asUint32 ( ) ;
155
157
if ( address < Constants . SAFE_HEAP_START ) {
156
158
return formatPointerOrReference ( wasm , value ) ;
@@ -180,15 +182,20 @@ function formatRawString<T extends CharArrayConstructor>(
180
182
return formatPointerOrReference ( wasm , value ) ;
181
183
}
182
184
183
- export function formatCString ( wasm : WasmInterface , value : Value ) : string | { [ key : string ] : Value | null } {
184
- return formatRawString ( wasm , value , Uint8Array , str => new TextDecoder ( ) . decode ( str ) ) ;
185
+ export function formatCString ( wasm : WasmInterface , value : Value ) : string | {
186
+ [ key : string ] : Value | null ,
185
187
}
188
+ { return formatRawString ( wasm , value , Uint8Array , str => new TextDecoder ( ) . decode ( str ) ) ; }
186
189
187
- export function formatU16CString ( wasm : WasmInterface , value : Value ) : string | { [ key : string ] : Value | null } {
188
- return formatRawString ( wasm , value , Uint16Array , str => new TextDecoder ( 'utf-16le' ) . decode ( str ) ) ;
190
+ export function formatU16CString ( wasm : WasmInterface , value : Value ) : string | {
191
+ [ key : string ] : Value | null ,
189
192
}
193
+ { return formatRawString ( wasm , value , Uint16Array , str => new TextDecoder ( 'utf-16le' ) . decode ( str ) ) ; }
190
194
191
- export function formatCWString ( wasm : WasmInterface , value : Value ) : string | { [ key : string ] : Value | null } {
195
+ export function formatCWString ( wasm : WasmInterface , value : Value ) : string | {
196
+ [ key : string ] : Value | null ,
197
+ }
198
+ {
192
199
// emscripten's wchar is 4 byte
193
200
return formatRawString ( wasm , value , Uint32Array , str => Array . from ( str ) . map ( v => String . fromCodePoint ( v ) ) . join ( '' ) ) ;
194
201
}
0 commit comments