Skip to content

Conversation

ExE-Boss
Copy link
Contributor

@ExE-Boss ExE-Boss commented Dec 12, 2020

This makes WebAssembly.Global generic to better match the runtime behaviour:


Q: Should I change this to use something more like:

declare namespace WebAssembly {
	class Global<T extends ValueType = ValueType> {
		constructor(descriptor: GlobalDescriptor<T>, v?: ValueTypeMap[T]);
		value: ValueTypeMap[T];
		valueOf(): ValueTypeMap[T];
	}

	type ValueType = keyof ValueTypeMap;
	interface ValueTypeMap {
		i32: number;
		i64: bigint;
		f32: number;
		f64: number;
	}
}

@ExE-Boss ExE-Boss force-pushed the types/wasm/generic-global branch from f9eecea to 3bd4988 Compare September 24, 2021 17:30
@sandersn
Copy link
Member

The types look like an improvement to me. @saschanaz would it be better to fix this upstream somewhere instead of overriding it here? If not I think this would be appropriate here.

@saschanaz
Copy link
Contributor

The IDL syntax does not support this kind of generics, so I think we need to override them. Looks good to me, feel free to merge 👍

@sandersn sandersn merged commit 63a13ca into microsoft:main Apr 24, 2023
@ExE-Boss ExE-Boss deleted the types/wasm/generic-global branch April 25, 2023 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants