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

Consider adding WASMInterface to the list of exports in lib/index.ts so I can reference IHasher from client code #60

Open
alasdaircs opened this issue Jun 17, 2024 · 2 comments

Comments

@alasdaircs
Copy link

I want to declare a variable of type IHasher in my TypeScript code, but it's declared in WASMInterface.ts and although that builds to /dist/lib/WASMInterface.d.ts, it's not exported in /lib/index.ts so I can't write:

import { IHasher } from 'hash-wasm';

If I attempt to reference it directly with import { IHasher } from 'hash-wasm/dist/lib/WASMInterface' I get compiler errors from my WebPack build.

Please consider adding:

export * from './WASMInterface';

to lib/index.ts

@alasdaircs
Copy link
Author

On reflection I've just found I was importing from the wrong place 🤦‍♂️:
This doesn't work: import { IHasher } from 'hash-wasm/lib/WASMInterface', probably because I'm stuck on an old version of TS
But this does work: import { IHasher } from 'hash-wasm/dist/lib/WASMInterface'

There's no urgency, but I still think it would be nice to be able to write:

import { IHasher } from 'hash-wasm'

@GabenGar
Copy link

You can instead use Awaited<ReturnType<typeof create***>> to capture the type of IHasher.

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