Skip to content

Commit 0505d3c

Browse files
authored
updated Storybook main.js to main.ts and included ts files (#1796)
1 parent 1654e43 commit 0505d3c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.storybook/main.js renamed to .storybook/main.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
const svgoConfig = require('../common/config/svgo');
2+
import type { StorybookConfig } from '@storybook/nextjs';
23

3-
const config = {
4-
stories: ['../components/**/__stories__/*.stories.js'],
4+
const config: StorybookConfig = {
5+
stories: [
6+
'../components/**/__stories__/*.mdx',
7+
'../components/**/__stories__/*.stories.@(js|jsx|mjs|ts|tsx)',
8+
],
59
staticDirs: ['../public'],
610
addons: [
711
'@storybook/addon-essentials',
@@ -13,7 +17,9 @@ const config = {
1317
],
1418
webpackFinal: async config => {
1519
// Find the Storybook Webpack rule relevant to SVG files.
20+
// @ts-expect-error => 'config.module' is possibly 'undefined'.ts(18048)
1621
const imageRule = config.module.rules.find(rule => {
22+
// @ts-expect-error => 'rule' is possibly 'null' or 'undefined'.ts(18049)
1723
if (rule.test && rule.test.test('.svg')) {
1824
console.log({ rule });
1925
return true;
@@ -23,9 +29,11 @@ const config = {
2329
});
2430

2531
// Ignore what Storybook does
32+
// @ts-expect-error => 'imageRule' is possibly 'null' or 'undefined'.ts(18049)
2633
imageRule.exclude = /\.svg$/;
2734

2835
// Configure .svg files to be loaded with @svgr/webpack
36+
// @ts-expect-error => 'config.module' is possibly 'undefined'.ts(18048)
2937
config.module.rules.push({
3038
test: /\.svg$/,
3139
use: [

0 commit comments

Comments
 (0)