Skip to content

Commit

Permalink
fix type in preview.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensacks committed Apr 7, 2023
1 parent ef6e3bb commit 3bea08e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,7 @@ Once you have finished these steps and launch storybook, you should see a globe
Clicking this globe icon will show a dropdown with the locales you defined in `parameters`.

Switching locales will use the strings defined in your locale json files.

## Migrating to Storybook 7

In `.storybook/preview.ts`, move the locale/locales to be under `globals` instead of `parameters`.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"build-storybook": "storybook build"
},
"dependencies": {
"storybook-i18n": "^2.0.2"
"storybook-i18n": "^2.0.6"
},
"devDependencies": {
"@storybook/addon-essentials": "^7.0.2",
Expand Down
3 changes: 2 additions & 1 deletion src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import type {Renderer, ProjectAnnotations} from '@storybook/types';
import i18n from 'storybook-i18n/preview';
import {withI18Next} from './withI18Next';

const i18nDecorators = i18n?.decorators || [];
// @ts-ignore
const i18nDecorators = i18n.decorators || [];

const preview: ProjectAnnotations<Renderer> = {
...i18n,
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10607,9 +10607,9 @@ __metadata:
languageName: node
linkType: hard

"storybook-i18n@npm:2.0.2":
version: 2.0.2
resolution: "storybook-i18n@npm:2.0.2"
"storybook-i18n@npm:^2.0.6":
version: 2.0.6
resolution: "storybook-i18n@npm:2.0.6"
peerDependencies:
"@storybook/components": ^7.0.0
"@storybook/manager-api": ^7.0.0
Expand All @@ -10622,7 +10622,7 @@ __metadata:
optional: true
react-dom:
optional: true
checksum: b5de71edd9540fac24f785f23dcb1fac07727cc2d2fa2bac693058f0f89d97483ab408acae8e61685162400025953f112ff98d8e26da2e86bd8aa2c31e8c2143
checksum: 430797a7f0a5a11636ac95e6e35064417e9a4cc79dfe991b99b84cecd630e0194561c4d5f3ed8013d892274288723fbe4d4faa95fa8f416f4d444bd059a9de1c
languageName: node
linkType: hard

Expand Down Expand Up @@ -10658,7 +10658,7 @@ __metadata:
react-i18next: ^12.2.0
rimraf: ^3.0.2
storybook: ^7.0.0
storybook-i18n: 2.0.2
storybook-i18n: ^2.0.6
tsup: ^6.6.3
typescript: ^4.9.5
vite: ^4.1.4
Expand Down

0 comments on commit 3bea08e

Please sign in to comment.