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

Wrong return type when searching for Stays #1000

Closed
gpembark opened this issue Jan 29, 2025 · 2 comments · Fixed by #1001
Closed

Wrong return type when searching for Stays #1000

gpembark opened this issue Jan 29, 2025 · 2 comments · Fixed by #1001

Comments

@gpembark
Copy link

When searching for stays:

const response = await duffel.stays.search({...})

The return value is typed as DuffelResponse<StaysSearchResult>

Therefore when trying to autocomplete, Typescript will think that response.data contains a single StaysSearchResult object, whereas instead the response is correctly wrapped in a results JSON field.

That's the behavior you see even in the library's test case:

Image
@andrejak
Copy link
Contributor

Thank you for reporting! We accept contributions, would you be able to submit a PR to change the type?

@SamHutchings
Copy link
Contributor

fixed, thank you for the report @gpembark

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

Successfully merging a pull request may close this issue.

3 participants