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

fix: update typings to match api response #763

Merged
1 commit merged into from
Jan 29, 2024
Merged

Conversation

finnboeger
Copy link
Contributor

Pull Request Type

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Other (please describe):

How to test this PR

Request a random story and log the result, compare what you get with what the typing says you should've gotten.
Example:
Screenshot 2024-01-25 at 19 53 06

What is the new behavior?

This fixes the typings that were broken in #697 and makes sure that the typing actually matches the API response.
All of these are on the ISbStoryData interface.
Many are fields have to be optional, as they are not always returned. I've marked them as optional as well, because you specifically requested that from the last fix, although the API does return null instead in many cases, so this will still be slightly incorrect typing.
One of the changes stands out, and that is marking parent as optional. Anything else is impossible over JSON, as a recursive structure needs an anchor; the root element does not have a parent.

Other information

src/interfaces.ts Outdated Show resolved Hide resolved
parent_id: number
path?: string
pinned: '1' | boolean
pinned?: '1' | boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the update to ISbMultipleStoriesData, this override here is unnecessary and could be removed.

@ghost ghost merged commit 7ea452e into storyblok:main Jan 29, 2024
1 check failed
Copy link

🎉 This PR is included in version 6.6.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants