TypeScript-DOM-lib-generator
TypeScript-DOM-lib-generator copied to clipboard
[Web API type definition issue] WebAssembly.Module interface is empty, allowing invalid assignments
Summary
The WebAssembly.Module interface is currently emitted as an empty interface, making it structurally compatible with any object in TypeScript
Expected vs. Actual Behavior
const abc: WebAssembly.Module = 0;
I would expect the above to be a compilation error.
But WebAssembly.Module gets emitted as an empty interface allowing all assignments.
interface Module { }
Playground Link
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAhgI2ALhgdQKYIIIQhgWwQBsBPAOgFkQATAV2IxgF4YAGAbiA
Browser Support
- [x] This API is supported in at least two major browser engines (not two Chromium-based browsers).
Have Tried The Latest Releases
- [x] This issue applies to the latest release of TypeScript.
- [x] This issue applies to the latest release of
@types/web.
Additional Context
Do we need to make WebAssembly.Module nominally typed? 🫣
I'm not aware of any other interfaces with only constructors/static methods but no instance members
Relates to #2075. I suspect that adding Symbol.toStringTag properties for the TS 6.0 DOM libs is the definitive fix for these cases.