Skip to content
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

to type signature does not support UrlRequest #25

Closed
peteralbert opened this issue Jan 21, 2021 · 6 comments
Closed

to type signature does not support UrlRequest #25

peteralbert opened this issue Jan 21, 2021 · 6 comments

Comments

@peteralbert
Copy link

For the code:

pipe(
  gotenberg('http://localhost:3000'),
  convert,
  url,
  to(landscape),
  please
)(address)

TypeScript complains:

Type 'RequestType.Url' is not assignable to type 'RequestType.Html'

in the url line. The actually execution works fine.

Could it be that the function overloading in to.ts lacks this additional signature?

(...opts: ConversionOptions[]): (request: UrlRequest) => UrlRequest

Let me know if I should create a PR!

Thanks

@yumauri
Copy link
Owner

yumauri commented Jan 21, 2021

Hm... I think I made it intentionally, to disable ability to set margins, because of warning on Gotenberg page

Attention: when converting a website to PDF, you should remove all margins. If not, some of the content of the page might be hidden.

But I guess I missed orientation and paper size...
Does it work when you interact with Gotenberg directly? (I cannot check right now)

@peteralbert
Copy link
Author

So the orientation works (when simply casting to to any). I haven’t tried size or margins yet - will try this tonight.

@peteralbert
Copy link
Author

Just verified - all three elements (orientation, size, margins) work without any issue!

@yumauri
Copy link
Owner

yumauri commented Jan 24, 2021

Cool, thank you!
Sorry for delay, was away from laptop for a few days.
Then I'll fix typings and will publish new version in a week :) Hopefully tomorrow

yumauri added a commit that referenced this issue Jan 26, 2021
@yumauri
Copy link
Owner

yumauri commented Jan 26, 2021

Published version 0.6.3 with fixed typings for url function.
@peteralbert check please

@peteralbert
Copy link
Author

Thank you - this solves the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants