Stream: jco

Topic: divergent mappings of WIT to TS and JS


view this post on Zulip Yoshua Wuyts (Nov 10 2023 at 19:46):

Hey I sat down with @Wassim Chegham today to ask him some questions about how TypeScript, and some of the mappings we were doing. And it seems there might be some differences between what our TypeScript type generator is generating - and the code we actually want to be writing.

view this post on Zulip Yoshua Wuyts (Nov 10 2023 at 19:49):

I think what we walked away from was with some questions. To speak for myself, I'm wondering:

view this post on Zulip Yoshua Wuyts (Nov 10 2023 at 19:50):

I think one thing we probably want to do is write down the mapping we perform from WIT -> TypeScript in our docs. But separately from that we should evaluate how we want to proceed here in the short term.

view this post on Zulip Yoshua Wuyts (Nov 10 2023 at 19:52):

(No need to answer this now; it's more to make sure I've raised this ahead of Monday's meeting; that way we get to perhaps think about this a little)

view this post on Zulip Wassim Chegham (Nov 10 2023 at 23:39):

also, I would like to know:

  1. what is the purpose of these TS definition files? Are they used/imported somewhere?
  2. in addition (or instead of) these TS definition files, can we directly generate an "empty" JavaScript implementation out of these WIT files.

(we can chat about this during our next call)

view this post on Zulip Guy Bedford (Nov 12 2023 at 05:52):

The current TS bindgen for the preview2-shim project is just the same bindgen as if WASI was implemented as a component itself. But WASI isn't implemented as a single component - instead we split its implementation across multiple modules for each subsystem. Therefore there is a difference between what we generate and the actual package type of the preview2-shim project. Bridging that difference with a wrapper TS file to reexport the right types would be great to see!


Last updated: Oct 23 2024 at 20:03 UTC