You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have upgraded to the SDK 5.1.2 from 5.0.2, and the destructuring of the content value from the useStoryBlok() response is now throwing a Typescript build error.
Expected Behavior
No build error. :)
Current Behavior
We receive the following build error:
src/pages/hub/categories/[slug].astro:60:9 - error ts(2339): Property 'content' does not exist on type 'ISbStoryData<ISbComponentType<string> & { [index: string]: any; }> | null'.
const { content } = await useStoryblok(
Steps to Reproduce
Create a project with Astro 5.1.7+, Vite 6.0+ and the Astro SDK 5.1.2
Add some code to your Astro page (frontmatter/serverside code head area) fetch using useStoryblok() and try and destructured the content value - e.g.
---
import { useStoryblok } from '@storyblok/astro'
const {content} = await useStoryblok( 'cdn/stories', {version: 'draft'}, {}, Astro as any);
// access destructured var
console.log(content)
---
<p>Test page</p>
The current solution we have is to remove destructuring, but it would be good to have this working again to simplify our code.
The text was updated successfully, but these errors were encountered:
nebrekab
changed the title
Destructuring from useStoryblok() no longer working in SDK 5.1.2 during build
Destructuring from useStoryblok() no longer working in SDK 5.1.2 during build - Typescript error
Jan 21, 2025
We have upgraded to the SDK 5.1.2 from 5.0.2, and the destructuring of the content value from the useStoryBlok() response is now throwing a Typescript build error.
Expected Behavior
No build error. :)
Current Behavior
We receive the following build error:
Steps to Reproduce
npm run build
You should now see the errors
package.json example:
package.json
The current solution we have is to remove destructuring, but it would be good to have this working again to simplify our code.
The text was updated successfully, but these errors were encountered: