diff --git a/code/lib/csf-tools/src/getStorySortParameter.test.ts b/code/lib/csf-tools/src/getStorySortParameter.test.ts index bd34207de7c0..b2672bb0198c 100644 --- a/code/lib/csf-tools/src/getStorySortParameter.test.ts +++ b/code/lib/csf-tools/src/getStorySortParameter.test.ts @@ -450,6 +450,31 @@ export default { ] `); }); + + it('storysort satisfies inline', () => { + expect( + getStorySortParameter(dedent` + enum ComponentGroups { + General = 'General' + } + export default { + parameters: { + options: { + storySort: { + order: ['General'] satisfies ComponentGroups[] + } + } + } + }; + `) + ).toMatchInlineSnapshot(` + { + "order": [ + "General", + ], + } + `); + }); }); describe('unsupported', () => { it('bad default export', () => { diff --git a/code/lib/csf-tools/src/getStorySortParameter.ts b/code/lib/csf-tools/src/getStorySortParameter.ts index 426017c5f410..70d323d4edd6 100644 --- a/code/lib/csf-tools/src/getStorySortParameter.ts +++ b/code/lib/csf-tools/src/getStorySortParameter.ts @@ -19,7 +19,9 @@ const getValue = (obj: t.ObjectExpression, key: string) => { return value; }; -const parseValue = (expr: t.Expression): any => { +const parseValue = (value: t.Expression): any => { + const expr = stripTSModifiers(value); + if (t.isArrayExpression(expr)) { return (expr.elements as t.Expression[]).map((o) => { return parseValue(o);