Giter Site home page Giter Site logo

Comments (3)

fgalarraga avatar fgalarraga commented on June 2, 2024

Has there been any updates on this? Trying to get Storyblok, nextjs 13 with app router to work. Seeing this error during build:

Code page.tsx:

import {
  getStoryblokApi, ISbStoriesParams
} from "@storyblok/react/rsc";
import StoryblokStory from "@storyblok/react/story";


export default async function Home() {
  const { data } = await fetchData();

  return (
    <div>
      <StoryblokStory story={data.story} />
    </div>
  )
}

export async function fetchData() {
  let sbParams: ISbStoriesParams = { version: "draft" };

  const storyblokApi = getStoryblokApi();
  return storyblokApi.get(`cdn/stories/home`, sbParams);
}

Here is the build error:

npm run build

> [email protected] build
> next build

 ✓ Creating an optimized production build
 ✓ Compiled successfully
   Linting and checking validity of types  .Failed to compile.

.next/types/app/page.ts:8:13
Type error: Type 'OmitWithTag<typeof import("D:/Repos/testsite/src/app/page"), "metadata" | "default" | "config" | "generateStaticParams" | "revalidate" | "dynamic" | "dynamicParams" | "fetchCache" | "preferredRegion" | "runtime" | "maxDuration" | "generateMetadata", "">' does not satisfy the constraint '{ [x: string]: never; }'.
  Property 'fetchData' is incompatible with index signature.
    Type '() => Promise<ISbResult>' is not assignable to type 'never'.

   6 |
   7 | // Check that the entry is a valid entry
>  8 | checkFields<Diff<{
     |             ^
   9 |   default: Function
  10 |   config?: {}
  11 |   generateStaticParams?: Function
   Linting and checking validity of types  ..

from storyblok-nuxt.

gbyesiltas avatar gbyesiltas commented on June 2, 2024

This package was incredibly useful for us for typing. I'm surprised it's not mentioned anywhere in the readme (it would be even more great if the module implemented this based on some options actually).

from storyblok-nuxt.

gbyesiltas avatar gbyesiltas commented on June 2, 2024

I just opened a PR that should improve typing for the useAsyncStoryblok composable

from storyblok-nuxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.