xlsx-populate
xlsx-populate copied to clipboard
would there be typescript definitions?
hi, is there any plan to provide typescript definitions? thanks
They don't exist now and there isn't a plan for it at this point. Pull requests are welcome.
would love to see this myself, maybe I'll take a crack at it if I can ever carve out some time. The very thorough use of JSDoc comments sure makes it easier. In fact... now that I look it up there's at least one project out there that does so automatically: https://github.com/teppeis/closure-ts
Building from the JSDoc would be ideal so that there is no duplication of effort.
+1
+1
I decided this was the lib to use, but decided not for this very reason.
I've started a project to create/test/improve a typescript definition file for xlsx-populate. Feel free to give it a try: https://github.com/JanLoebel/types-xlsx-populate
Any help is appreciated!
Adding type definitions to this project is quite simple:
- Run
npm install --save-dev typescript
. - Create a
tsconfig.json
file like:{ "compilerOptions": { "target": "ES5", "outDir": "types", "newLine": "LF", "allowJs": true, "declaration": true, "emitDeclarationOnly": true }, "include": [ "lib" ], "compileOnSave": false }
- Add
"types": "types/XlsxPopulate.d.ts"
topackage.json
. - Run
npx tsc
to generate the declaration files.
Unfortunately, the JSDoc comments have various issues. Adding "checkJs": true
in tsconfig.json
results in 653 errors being found. Some of those could probably be fixed by using import types where necessary, but in other cases the types are very weak (there are a lot of ... does not exist on type '{}'
errors, for example).
😞
Edit: Other issues: