Closed only-cliches closed 6 years ago
Thanks for the contribution (and sorry for the late response - I've been off GitHub for a while now). I'll try to get into this in the next weeks/months. One thing that I'll probably change in the build script is to use a more cross-platform "move" command since mv
wouldn't work on Windows.
No worries. π Honestly thinking about it more, I donβt think the move is needed. Since the build folder is published to NPM we can just leave the typings there. That would leave the only changes being an update to tsconfig and package.json
I've committed (some of) the changes (with some additional updates/tweaks). The types are now available at:
https://cdn.jsdelivr.net/npm/lzutf8/build/production/lzutf8.d.ts
(They are not included in the git repository since the build directories are not included)
(BTW: I believe the declarationDir
in tsconfig
allows to specify a custom output directory for the output declaration files)
The generated declaration file contains lots of unnecessary internal methods (the only one actually required is the last declare namespace LZUTF8
block in the file), and there are some unresolvable types, in particular: the Node types Buffer
and stream
. I'm hoping that TypeScript automatically casts unknown types to any
when the types are consumed. If that's the case it shouldn't be a problem. Otherwise I'll need to maintain a custom typing file, I guess (or use some hacks etc.).
Based on the TS docs package.json
should refer to the declaration file in the types
(or typings
) property (added). I'm assuming that the TS compiler scans for these references in node_modules
.
Please let me know if there's any way for this to be improved. I'll close the PR/issue for now.
PR for issue #14
Considering this project is already written in Typescript, we only need to tweak the build script and package.json file to take advantage of typings.
typings
reference topackage.json
.shell:moveDefinitionFiles
to copy the definition file form the build/production folder to the newtypes
folder.buildProduction
task.tsconfig.json
to emit typings.This should make it so folks can use typings when they npm install your project. π