jco icon indicating copy to clipboard operation
jco copied to clipboard

gen-host-js: TypeScript type verifications for instance imports

Open guybedford opened this issue 3 years ago • 0 comments

In https://github.com/bytecodealliance/wit-bindgen/pull/406, having imports treated as ES module imports, results in their types no longer being asserted.

The problem is how to assert the imported types, as opposed to the TypeScript compiler checking them against what is being imported.

A type-level assertion type like type AssertType<Expected, Actual extends Expected> = void may be possible if we were outputting a .ts file for the main interface instead of just a declaration, but isn't permitted in the ambient declaration file.

guybedford avatar Oct 28 '22 18:10 guybedford