Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Adds typescript declarations #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

covertbert
Copy link

@covertbert covertbert commented Dec 4, 2018

I've made a start to this and I think the declarations file is good but I may need a bit of help.

Specifically, by default, when you run an npm install rollup seems to automatically generate a declaration file based on the JSDoc configurations you've set and, no matter what I do, that seems to be the only rehook.d.ts that ends up in dist.

I was initially installing a bunch of typescript-related Babel and Rollup dependencies to build it and then it occurred to me that it's a little pointless when all I need to do is copy the file, so I installed a plugin to do that. I can see the output suggest that it's doing what I asked (it says it's copying index.d.ts to dist) but then when you check dist it's just the file generated from JSDoc.

It occurred to me that maybe manually making a declarations file is the wrong way anyway. The reason why I did it in the first place is because the auto-generated file wasn't getting it quite right (wasn't exporting the declarations and using non-primitive boxed objects) but maybe it's possible to resolve these things by doing something different in the JSDoc config.

EDIT: I feel stupid, I just noticed this "build:types": "jsdoc -t node_modules/@otris/jsdoc-tsd -r ./src/rehook -d dist/rehook.d.ts",

Still I'm not sure whether the right thing to do is continue with what you've done here and try to get the auto-generation to spit out a correct declarations file or if going the manual route is right.

@Synvox
Copy link
Owner

Synvox commented Dec 4, 2018

@covertbert I added those types for documentation in editor. I don't mind swapping them all out for better ones if we can have them.

@covertbert
Copy link
Author

covertbert commented Dec 5, 2018

@covertbert I added those types for documentation in editor. I don't mind swapping them all out for better ones if we can have them.

Cool I'll probably go down that route then as I don't think the library we're using to parse JSDoc can quite handle everything we need to do.

@platypusrex
Copy link

Any chance of this getting merged?

@covertbert
Copy link
Author

covertbert commented Mar 1, 2019

Any chance of this getting merged?

Unfortunately it's definitely not in a mergeable state as I've been really busy with other things. Feel free to take over though if you like!

What needs to be done is going through and making sure all the type declarations are correct when you actually try to implement all of rehook's methods

@quagliero
Copy link
Contributor

For anyone interested, there's a forked version with a types declaration file at https://www.npmjs.com/package/@team-griffin/rehook

Although they're just any for now, it means you can get up and running with it in a typescript app.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants