Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(WebAssembly): Make WebAssembly.Global generic #963

Merged
merged 4 commits into from
Apr 24, 2023

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