Description
Functions that accept or return a GHashTable have those parameters exposed as plain objects in GJS. Only string (utf8, filename) and integer (bool, 8-32 bit ints) keys are supported. gunichar can be passed as string or integer. Other types will throw during marshalling.
The current type definitions have these parameters as GLib.HashTable<K, V> but I don't believe there's currently any way to actually get a GLib.HashTable object in GJS.
Current vs Expected Behavior
Current:
// Current behavior/type definition
// return value in GLib.Uri:
static parse_params(params: string, length: bigint | number, separators: string, flags: UriParamsFlags): HashTable<string, string>;
// in-argument in GLib.HashTable:
static size(hash_table: { [key: string]: any } | HashTable<never, never>): number;
Expected:
// Expected behavior/type definition
// in GLib.Uri:
static parse_params(params: string, length: bigint | number, separators: string, flags: UriParamsFlags): { [key: string]: string; };
// in GLib.HashTable:
static size(hash_table: never): number;
// (i.e., function can't be called because the key type isn't string or number)
Example
See above. To validate, you could check that there are no GLib.HashTable parameters in the generated type definitions.
References
Additional Context
Description
Functions that accept or return a GHashTable have those parameters exposed as plain objects in GJS. Only string (utf8, filename) and integer (bool, 8-32 bit ints) keys are supported.
gunicharcan be passed as string or integer. Other types will throw during marshalling.The current type definitions have these parameters as
GLib.HashTable<K, V>but I don't believe there's currently any way to actually get aGLib.HashTableobject in GJS.Current vs Expected Behavior
Current:
Expected:
Example
See above. To validate, you could check that there are no
GLib.HashTableparameters in the generated type definitions.References
Additional Context