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

Add TypeScript types to final bundle #75

Closed
nikitavoloboev opened this issue Mar 11, 2023 · 2 comments
Closed

Add TypeScript types to final bundle #75

nikitavoloboev opened this issue Mar 11, 2023 · 2 comments

Comments

@nikitavoloboev
Copy link

nikitavoloboev commented Mar 11, 2023

I would love to get autocomplete on the exposed wasm-git module.

Not sure how to achieve it best though. I thought perhaps wasm-git npm package exposes one WasmGit TypeScript type (not sure on name) and then in code you can do:

;(async () => {
  const libgit: WasmGit = await libgitPromise

This way libgit is fully typed at this point. Can type libgit. and get completion for callMain. Get completions for callMain commands too.

To achieve this I guess we can parse C code functions that are defined in commands array and create type definitions? Or maybe there's a nicer way.

@petersalomonsen
Copy link
Owner

I think this is beyond the purpose and goals of wasm-git itself, but for sure would be nice as a separate project building on wasm-git. The purpose of wasm-git is first of all to be a port of libgit2 to WebAssembly using Emscripten, and not to introduce any API's on top.

This is also discussed earlier in this issue here: #30 (comment)

@nikitavoloboev
Copy link
Author

Makes sense. I will just expose types for functions I use for wasm-git, if it becomes an issue I might make a separate repo with types for libgit2 commands.

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

No branches or pull requests

2 participants