-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export types also from
@nuxtjs/storybook
(#749)
<!-- ☝️ PR title should follow conventional commits (https://conventionalcommits.org). In particular, the title should start with one of the following types: - docs: 📖 Documentation (updates to the documentation or readme) - fix: 🐞 Bug fix (a non-breaking change that fixes an issue) - feat: ✨ New feature/enhancement (a non-breaking change that adds functionality or improves existing one) - feat!/fix!:⚠️ Breaking change (fix or feature that would cause existing functionality to change) - chore: 🧹 Chore (updates to the build process or auxiliary tools and libraries) --> ### 🔗 Linked issue <!-- If it resolves an open issue, please link the issue here. For example "Resolves #123" --> ### 📚 Description Export types from `@storybook/vue3` also at `@nuxtjs/storybook`. <!-- Describe your changes in detail --> <!-- Why is this change required? What problem does it solve? -->
- Loading branch information
1 parent
e8837c4
commit a3fa103
Showing
10 changed files
with
60 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"cSpell.words": ["composables", "dedupe", "nuxt", "ofetch", "Pinia"] | ||
"cSpell.words": ["composables", "dedupe", "nuxt", "nuxtjs", "ofetch", "Pinia"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: 'TypeScript' | ||
description: 'Guide on how to use TypeScript with the Nuxt module' | ||
--- | ||
|
||
To use the Nuxt module with TypeScript, ensure that imports typically from `@storybook/*` are now replaced by imports from `@nuxtjs/storybook` (or `@storybook-vue/nuxt` if the Nuxt module is not used). This is needed since the Storybook packages are dependencies of the Nuxt module, and are not directly installed in the project. | ||
|
||
The following example demonstrates how to use types when configuring Storybook and for writing stories. | ||
|
||
::code-group | ||
|
||
```typescript [.storybook/main.ts] | ||
import { StorybookConfig } from '@nuxtjs/storybook' // not from '@storybook/core-common' | ||
export default { | ||
stories: ['../components/**/*.stories.ts'], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials'], | ||
framework: '@storybook/vue3', | ||
} as StorybookConfig | ||
``` | ||
|
||
```typescript [components/Button.stories.ts] | ||
import { Meta, Story } from '@nuxtjs/storybook' // not from '@storybook/vue' | ||
import Button from './Button.vue' | ||
|
||
export default { | ||
title: 'Example/Button', | ||
component: Button, | ||
} as Meta | ||
|
||
const Template: Story = (args) => ({ | ||
components: { Button }, | ||
setup() { | ||
return { args } | ||
}, | ||
template: '<Button v-bind="args" />', | ||
}) | ||
|
||
export const Primary = Template.bind({}) | ||
Primary.args = { | ||
primary: true, | ||
label: 'Button', | ||
} | ||
``` | ||
|
||
:: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
// Path: src/types.d.ts'; | ||
export * from '@storybook/vue3' | ||
export * from './types.d' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.