Skip to content

Commit 072266b

Browse files
committed
fix transform tags logic
1 parent 807ce35 commit 072266b

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"release": "pnpm run build && auto shipit",
5050
"start": "pnpm run build && concurrently \"pnpm run build --watch\" \"pnpm run storybook --quiet\"",
5151
"storybook": "storybook dev --port 6006 --no-open",
52-
"test": "vitest run",
53-
"test:watch": "vitest watch"
52+
"test": "vitest"
5453
},
5554
"dependencies": {
5655
"@storybook/csf": "^0.1.13",

src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe(transformComponentMetaToDefineMeta.name, () => {
143143
);
144144
});
145145

146-
it('tags with an array expression are left as-is', async ({ expect }) => {
146+
it.only('tags with an array expression are left as-is', async ({ expect }) => {
147147
const code = `
148148
<script context="module">
149149
import { Story } from "@storybook/addon-svelte-csf";

src/compiler/pre-transform/codemods/component-meta-to-define-meta.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function transformComponentMetaToDefineMeta(params: Params): ESTreeAST.Va
2727
const { component, comment } = params;
2828
const { attributes, start, end } = component;
2929

30-
let properties: ESTreeAST.ObjectExpression['properties'] = [];
30+
const properties: ESTreeAST.ObjectExpression['properties'] = [];
3131

3232
for (const attribute of attributes) {
3333
if (attribute.type === 'Attribute') {
@@ -150,7 +150,7 @@ function transformTags(tags: SvelteAST.Attribute): void {
150150

151151
// tags.value is SvelteAST.ExpressionTag
152152
if (!Array.isArray(tags.value)) {
153-
if ('value' in tags.value.expression && typeof tags.value.expression.value !== 'string') {
153+
if (typeof (tags.value.expression as any).value !== 'string') {
154154
// NOTE: The error on invalid type (not a string) is likely visible
155155
// 1. via TypeScript
156156
// 2. and thrown by storybook internal, right?

0 commit comments

Comments
 (0)