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

Typescript Definitions Not Available #94

Open
GeoffCapper opened this issue May 12, 2020 · 3 comments
Open

Typescript Definitions Not Available #94

GeoffCapper opened this issue May 12, 2020 · 3 comments

Comments

@GeoffCapper
Copy link

Hi,

I've used npm install to add hyperform to a project that uses Typescript. If I then write something like:

let hf: Hyperform = hyperform(document.forms[0]);

typing hf as either Hyperform or HyperformStatic my IDE complains about it. Looking into the package under node_modules I can see in package.json there is a types node pointing to "index.d.ts" but this is nowhere to be found in the folder, or in @types.

Am I doing something wrong or...?

Thanks!

@Boldewyn
Copy link
Contributor

Thank you for pointing this out! Yes, the index.d.ts file was indeed missing from the npm package. If you update to hyperform@0.12, it will be included.

A word of warning: I don’t use TypeScript myself yet. The index.d.ts might therefore not be correct or fully functional. If you encounter any issue, I’d love to hear it (and fix it then, of course 😃 ).

@GeoffCapper
Copy link
Author

Thanks @Boldewyn. I'm only just beginning myself, which makes it hard to sort my errors from other problems. I've updated and it has the index.d.ts in there now. For some reason it's not picking up correctly from node_modules, and still not believing there is a valid type, but I suspect it's something I'm doing wrong. I'll try again tomorrow and get back to you if I find any issues. Thanks again for looking at this so quickly.

@GeoffCapper
Copy link
Author

I've got it picking up the file, but I've had to resort to using the "any" type on Hyperform as the type file doesn't seem to match up with the script. I've had a go at rewriting it but my knowledge isn't up to the task yet.

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