nuxt-modules / storybook

Storybook integration with Nuxt.
https://storybook.nuxtjs.org
400 stars 91 forks source link

ts error when using `docgen` #703

Closed RodriguezTheo closed 3 weeks ago

RodriguezTheo commented 1 month ago

Hi,

I don't understand how to use 'vue-component-meta' with @nuxtjs/storybook plugin. I can't use typescript type props for the moment and I need to add more info in args stories...

What's is the problem ?

If i use @storybook/vue3-vite like in the doc i can't launch the project. I have errors.

image

// main.ts
import type { StorybookConfig } from "@storybook-vue/nuxt";

const config: StorybookConfig = {
  stories: [
    "../components/**/*.stories.@(js|jsx|mjs|ts|tsx)",
  ],
  addons: [
    "@storybook/addon-docs",
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/addon-themes",
    "@storybook/addon-a11y",
  ],
  core: {
    disableTelemetry: true,
  },
  framework: {
    name: "@storybook-vue/nuxt",
    options: {
      docgen: "vue-component-meta",
    },
  },
};
export default config;
// package.json

// ...
  "devDependencies": {
    "@nuxtjs/i18n": "^8.0.2",
    "@nuxtjs/storybook": "^8.1.5",
    "@storybook/addon-a11y": "^8.2.2",
    "@storybook/addon-docs": "^8.2.2",
    "@storybook/addon-essentials": "^8.2.2",
    "@storybook/addon-interactions": "^8.2.2",
    "@storybook/addon-links": "^8.2.2",
    "@storybook/addon-mdx-gfm": "8.2.2",
    "@storybook/addon-storysource": "^8.2.2",
    "@storybook/addon-themes": "^8.2.2",
    "@storybook/blocks": "^8.2.2",
    "@storybook/test": "^8.2.2",
    "@storybook/vue3": "^8.2.2",
    "@storybook/vue3-vite": "^8.2.2",
    "@types/node": "^20.12.7",
    "@vitejs/plugin-vue": "^5.0.4",
    "eslint": "^8.56.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-prettier": "^5.1.3",
    "eslint-plugin-storybook": "^0.8.0",
    "eslint-plugin-vue": "^9.21.1",
    "prettier": "^3.2.5",
    "storybook": "^8.2.2",
    "typescript": "^5.3.3"
  },

// ...
// nuxt.config.ts
  modules: [
    "@nuxtjs/storybook"
  ],

Thank's for help :)

tobiasdiez commented 1 month ago

Strange, this ts error should have been fixed with https://github.com/nuxt-modules/storybook/pull/649. @mehcode is it working for you now?

RodriguezTheo commented 1 month ago

That's why I update packages but I don't understand.... :/

mehcode commented 1 month ago

Yeah. This is working for me.

image

I would confirm you are using the 8.1.x release of storybook-vue/nuxt. That's been the issues for awhile as the packages weren't being updated in lockstep before. Check your lockfile.