-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
Types (.d.ts) in npm package #463
Types (.d.ts) in npm package #463
Conversation
Awesome! Three thoughts: Can a typescript example be added? I guess it could be something similar to the I'm a little hesitant to pollute the I have not verified it, but it looks like some internal types are exposed. Is this required or can they be hidden somehow? |
Thanks for feedback!
Ok, I will try to prepare it today or tomorrow.
Yes this is what I also don't like much and tried to avoid in previous PR (#462), but after playing with various options still got invalid either from the point of syntax (with
Yes, now everything "exportable" is exported through newly added index.ts with wildcards export statements inside ( |
Thanks for letting me know about the lib size! Reduced it too ~100kb now (only dist folder) in Hmm, how about in a separate And after looking into it a bit more my concern over exposing internal types was probably invalid since the user will never interact with them. |
I've added typescript+nodejs sample (
Yes. highly possible that d.ts files could be "moved" from ./dist to ./dist/types by configuring some
Not sure what do you mean by "after publish", but for npm package all |
… script: results in single dist/index.d.ts
# Conflicts: # package.json
I have added dts-bundle-generator dependency and PR summary:
|
Not sure if I'm doing something wrong here, but when I run |
Plus, it would be super nice if it was possible to implement that you would get |
After looking into it a bit it seems impossible to extend the published jsPDF types with a autoTable function (without modifying them somehow). The next best thing I can think of is the below. What do you think?
|
I've tried to run that example from scratch (with Regarding to |
The plugins included in DefinitelyTypes are included the jspdf dist bundle which this plugin is not. It seems it should be possible to extend a class with new props, but with the types on DefinitelyTyped can't find a way. |
I found one example |
Pull Request Description:
I've enabled d.ts generation in tsconfig.json and added
typings
property into package.json.Motivation:
Utilize types power in pretty complex jsPDF-AutoTable config without import of source files. Currently in project I have to had something like:
which is generally bad practice and causes issues with tsc.