-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add proper type exports #8
Conversation
…s don't bubble up into consumers type checks
Hey @JonathanWolfe, first of all, thanks for reaching out. I'm not sure if I'm okay with your PR. Obviously (if you look at the ToDo in the source code), the line in question, or rather the utility function it belongs to, needs to be refactored. Your PR obfuscates the issue rather than fixing it. Alas, I will not merge this PR – but I will keep it open until the issue has been resolved (by you, me, or anyone else). I have added an overdue ticket to the project's KanBan board, though! Feel free to refactor the utility function, yourself. This repo has been a little inactive, recently, because I have taken on replacing the wp-types package with my own because of the known issues – so it's unlikely that I'll be fixing the utility function myself anytime soon. Keep it up! |
hey @JonathanWolfe, how are you doing – do you still use this package? I'm planning on updating it and fixing the console errors in the near future. |
Yep, we still use it. We do have 2 patches (1 for error handling, 1 for pagination) we apply but haven't fixed this specific issue. I'll post the patches here after lunch and my meetings and lunch. |
oh, that's cool! no rush from my side, it's 9pm over here and I won't need the client, myself, for another few weeks – but I'll make sure to review and apply your patches asap, of course. |
wordpress-api-client+0.4.6.patch.txt |
Heya, thanks for the patch! I am going to patch in the changes to |
Returning pagination on all routes definitely seems like the right thing to do, especially since it's dependent on the per_page of the query being used. The current getTotal method isn't useful without allowing for query parameters to be sent in with it. If HEAD requests did return the wp pagination headers on all hosts (wpengine doesn't respond for instance) then getTotal could have a use case, but I don't have enough research on other hosted WP sites to know if it's that's true enough to stay. |
okay, so we need to implement URLSearchParams (such as |
@all-contributors please add @JonathanWolfe for code, ideas should somebody else be added, @JonathanWolfe ? |
I've put up a pull request to add @JonathanWolfe! 🎉 |
No, I'm the only one who's modified the library at my work. |
I've released v0.4.7 with the defaultQuery applied to |
v0.4.8 is out now, including declaration files. I also fixed the bug which was causing the error (I think), and added unit tests to the function. |
Add
.d.ts
exports and point thepackage.json
's"types" to it so that internal type errors don't bubble up into consumers type checks.Interal type errors can be seen by turning
noUncheckedIndexedAccess
on giving an output like:The compiler option
skipLibCheck
disables checking.d.ts
for node_modules to fix this exact issue, but since you pointed types to the actual.ts
files it ignored that setting.