-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
bugpending-triage[Status] Ticket is pending to be prioritised[Status] Ticket is pending to be prioritised
Description
Package
@storyblok/astro (Astro Integration)
Bug Description
When trying to use the getLiveStory there is a type mismatch between the required Astro global and the actual one. This always happens when you use e.g. getStaticPaths(), which changes the type of the global.
Steps to Reproduce
- Use the
astro/tsconfigs/strictconfig for strict type checks - Create a
getStaticPaths()function that returns someGetStaticPathsResult. - Try to use
getLiveStory - Run
astro checkor see the error in your editor
Expected Behavior
Should not produce a type error even in strict mode
Actual Behavior
Does produce an error:
Argument of type 'Readonly<AstroGlobal<never, (_props: never) => any, { slug: string; }>>' is not assignable to parameter of type 'Readonly<AstroGlobal<Record<string, any>, AstroComponentFactory, Record<string, string | undefined>>>'.
Types of property 'self' are incompatible.
Code Sample
---
import { getLiveStory } from '@storyblok/astro';
export function getStaticPaths() {
const paths: Array<{ params: { slug: string } }> = [];
return paths;
}
const liveStory = await getLiveStory(Astro);
---Environment
npmPackages:
@storyblok/astro: ^7.3.3 => 7.3.3
astro: ^5.14.5 => 5.14.5Additional Context
- This only happens when you specify functions that update the
Astroglobal likegetStaticPaths - This only happens when you use at least Astros
strictTypeScript preset, not in thebaseone.
The problem was already mentioned in #99 but "could not be reproduced". Probably because it does not happen with the Astros base ts config.
F0rce
Metadata
Metadata
Assignees
Labels
bugpending-triage[Status] Ticket is pending to be prioritised[Status] Ticket is pending to be prioritised