Skip to content

Commit 6983377

Browse files
committed
fix: better handle readonly InputType options
1 parent 16942d6 commit 6983377

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/story.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,25 @@ const strict: XMeta<ButtonArgs> = {
5757
argTypes: { x: { type: { name: 'string' } } },
5858
};
5959

60+
const options = ['foo', 'bar'] as const;
61+
const simpleWithReadonlyOptions: XMeta<ButtonArgs> = {
62+
title: 'simple',
63+
component: Button,
64+
tags: ['foo', 'bar'],
65+
decorators: [(storyFn, context) => `withDecorator(${storyFn(context)})`],
66+
parameters: { a: () => null, b: NaN, c: Symbol('symbol') },
67+
loaders: [() => Promise.resolve({ d: '3' })],
68+
args: { x: '1' },
69+
argTypes: {
70+
x: {
71+
control: {
72+
type: 'select',
73+
},
74+
options: options,
75+
}
76+
},
77+
}
78+
6079
// NOTE Various story usages
6180
const Simple: XStory = () => 'Simple';
6281

src/story.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export interface InputType {
131131
/**
132132
* @see https://storybook.js.org/docs/api/arg-types#options
133133
*/
134-
options?: any[];
134+
options?: readonly any[];
135135
/**
136136
* @see https://storybook.js.org/docs/api/arg-types#table
137137
*/

0 commit comments

Comments
 (0)