-
Notifications
You must be signed in to change notification settings - Fork 14
Adds typescript declarations #4
base: master
Are you sure you want to change the base?
Conversation
@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. |
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 |
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 |
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 annpm 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 onlyrehook.d.ts
that ends up indist
.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 copyingindex.d.ts
todist
) but then when you checkdist
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.