From c56eb03413431df6e6005dab41b220837aec4205 Mon Sep 17 00:00:00 2001 From: Gorkem Baris Yesiltas Date: Wed, 8 May 2024 12:26:24 +0200 Subject: [PATCH] feat(typing): added generic support and imporved return type and updated examples --- README.md | 30 ++++++++++++++++++++ package-lock.json | 2 +- playground/pages/articles/[slug].vue | 20 +++++++++---- playground/pages/index.vue | 3 +- src/runtime/composables/useAsyncStoryblok.ts | 13 +++++---- 5 files changed, 56 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index eec52f8..5e44337 100755 --- a/README.md +++ b/README.md @@ -275,6 +275,36 @@ Which is the short-hand equivalent to using `useStoryblokApi` inside `useState` > The `useState` is an SSR-friendly `ref` replacement. Its value will be preserved after server-side rendering (during client-side hydration). +You can also use the `useAsyncStoryblok` composable in a type-safe way: + +```html + + + +``` + #### Rendering Rich Text You can easily render rich text by using the `renderRichText` function that comes with `@storyblok/nuxt` and a Vue computed property: diff --git a/package-lock.json b/package-lock.json index 417c6e1..af2fe63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@nuxt/module-builder": "^0.6.0", "@nuxt/schema": "^3.8.0", "@nuxt/test-utils": "^3.8.0", - "@nuxtjs/eslint-config-typescript": "*", + "@nuxtjs/eslint-config-typescript": "latest", "@types/node": "^20.8.10", "cypress": "^13.4.0", "eslint": "^8.52.0", diff --git a/playground/pages/articles/[slug].vue b/playground/pages/articles/[slug].vue index d196aec..2966381 100644 --- a/playground/pages/articles/[slug].vue +++ b/playground/pages/articles/[slug].vue @@ -1,13 +1,23 @@ diff --git a/playground/pages/index.vue b/playground/pages/index.vue index 0042b5b..b611ff6 100644 --- a/playground/pages/index.vue +++ b/playground/pages/index.vue @@ -1,9 +1,10 @@