@storybook/react 10.5.2 → 10.6.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1104 @@
1
+ import { ComponentProps, ComponentType, JSX } from "react";
2
+ import { AnnotatedStoryFn, ArgTypes, Args, Args as Args$1, ArgsFromMeta, ArgsStoryFn, Canvas, ComponentAnnotations, DecoratorFunction, LoaderFunction, Parameters as Parameters$1, ProjectAnnotations, Renderer, StoryAnnotations, StoryContext, StrictArgs, StrictArgs as StrictArgs$1, WebRenderer } from "storybook/internal/types";
3
+ import { RootOptions } from "react-dom/client";
4
+ import { AddonTypes, InferTypes, Meta, Preview, PreviewAddon, Story } from "storybook/internal/csf";
5
+
6
+ //#region node_modules/type-fest/source/union-to-intersection.d.ts
7
+ /**
8
+ Convert a union type to an intersection type.
9
+
10
+ Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153).
11
+
12
+ @example
13
+ ```
14
+ import type {UnionToIntersection} from 'type-fest';
15
+
16
+ type Union = {the(): void} | {great(arg: string): void} | {escape: boolean};
17
+
18
+ type Intersection = UnionToIntersection<Union>;
19
+ //=> {the(): void} & {great(arg: string): void} & {escape: boolean}
20
+ ```
21
+
22
+ @category Type
23
+ */
24
+ type UnionToIntersection<Union> = (// `extends unknown` is always going to be the case and is used to convert the
25
+ // `Union` into a [distributive conditional
26
+ // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types).
27
+ Union extends unknown // The union type is used as the only argument to a function since the union
28
+ // of function arguments is an intersection.
29
+ ? (distributedUnion: Union) => void // This won't happen.
30
+ : never // Infer the `Intersection` type since TypeScript represents the positional
31
+ // arguments of unions of functions as an intersection of the union.
32
+ ) extends ((mergedIntersection: infer Intersection) => void) // The `& Union` is to ensure result of `UnionToIntersection<A | B>` is always assignable to `A | B`
33
+ ? Intersection & Union : never;
34
+ //#endregion
35
+ //#region node_modules/type-fest/source/keys-of-union.d.ts
36
+ /**
37
+ Create a union of all keys from a given type, even those exclusive to specific union members.
38
+
39
+ Unlike the native `keyof` keyword, which returns keys present in **all** union members, this type returns keys from **any** member.
40
+
41
+ @link https://stackoverflow.com/a/49402091
42
+
43
+ @example
44
+ ```
45
+ import type {KeysOfUnion} from 'type-fest';
46
+
47
+ type A = {
48
+ common: string;
49
+ a: number;
50
+ };
51
+
52
+ type B = {
53
+ common: string;
54
+ b: string;
55
+ };
56
+
57
+ type C = {
58
+ common: string;
59
+ c: boolean;
60
+ };
61
+
62
+ type Union = A | B | C;
63
+
64
+ type CommonKeys = keyof Union;
65
+ //=> 'common'
66
+
67
+ type AllKeys = KeysOfUnion<Union>;
68
+ //=> 'common' | 'a' | 'b' | 'c'
69
+ ```
70
+
71
+ @category Object
72
+ */
73
+ type KeysOfUnion<ObjectType> = // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008
74
+ keyof UnionToIntersection<ObjectType extends unknown ? Record<keyof ObjectType, never> : never>;
75
+ //#endregion
76
+ //#region node_modules/type-fest/source/is-any.d.ts
77
+ /**
78
+ Returns a boolean for whether the given type is `any`.
79
+
80
+ @link https://stackoverflow.com/a/49928360/1490091
81
+
82
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
83
+
84
+ @example
85
+ ```
86
+ import type {IsAny} from 'type-fest';
87
+
88
+ const typedObject = {a: 1, b: 2} as const;
89
+ const anyObject: any = {a: 1, b: 2};
90
+
91
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
92
+ return object[key];
93
+ }
94
+
95
+ const typedA = get(typedObject, 'a');
96
+ //=> 1
97
+
98
+ const anyA = get(anyObject, 'a');
99
+ //=> any
100
+ ```
101
+
102
+ @category Type Guard
103
+ @category Utilities
104
+ */
105
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
106
+ //#endregion
107
+ //#region node_modules/type-fest/source/is-optional-key-of.d.ts
108
+ /**
109
+ Returns a boolean for whether the given key is an optional key of type.
110
+
111
+ This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
112
+
113
+ @example
114
+ ```
115
+ import type {IsOptionalKeyOf} from 'type-fest';
116
+
117
+ type User = {
118
+ name: string;
119
+ surname: string;
120
+
121
+ luckyNumber?: number;
122
+ };
123
+
124
+ type Admin = {
125
+ name: string;
126
+ surname?: string;
127
+ };
128
+
129
+ type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
130
+ //=> true
131
+
132
+ type T2 = IsOptionalKeyOf<User, 'name'>;
133
+ //=> false
134
+
135
+ type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
136
+ //=> boolean
137
+
138
+ type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
139
+ //=> false
140
+
141
+ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
142
+ //=> boolean
143
+ ```
144
+
145
+ @category Type Guard
146
+ @category Utilities
147
+ */
148
+ type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
149
+ //#endregion
150
+ //#region node_modules/type-fest/source/optional-keys-of.d.ts
151
+ /**
152
+ Extract all optional keys from the given type.
153
+
154
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
155
+
156
+ @example
157
+ ```
158
+ import type {OptionalKeysOf, Except} from 'type-fest';
159
+
160
+ type User = {
161
+ name: string;
162
+ surname: string;
163
+
164
+ luckyNumber?: number;
165
+ };
166
+
167
+ const REMOVE_FIELD = Symbol('remove field symbol');
168
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
169
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
170
+ };
171
+
172
+ const update1: UpdateOperation<User> = {
173
+ name: 'Alice',
174
+ };
175
+
176
+ const update2: UpdateOperation<User> = {
177
+ name: 'Bob',
178
+ luckyNumber: REMOVE_FIELD,
179
+ };
180
+ ```
181
+
182
+ @category Utilities
183
+ */
184
+ type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
185
+ ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
186
+ : never;
187
+ //#endregion
188
+ //#region node_modules/type-fest/source/required-keys-of.d.ts
189
+ /**
190
+ Extract all required keys from the given type.
191
+
192
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
193
+
194
+ @example
195
+ ```
196
+ import type {RequiredKeysOf} from 'type-fest';
197
+
198
+ declare function createValidation<
199
+ Entity extends object,
200
+ Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
201
+ >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
202
+
203
+ type User = {
204
+ name: string;
205
+ surname: string;
206
+ luckyNumber?: number;
207
+ };
208
+
209
+ const validator1 = createValidation<User>('name', value => value.length < 25);
210
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
211
+
212
+ // @ts-expect-error
213
+ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
214
+ // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
215
+ ```
216
+
217
+ @category Utilities
218
+ */
219
+ type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
220
+ ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
221
+ //#endregion
222
+ //#region node_modules/type-fest/source/is-never.d.ts
223
+ /**
224
+ Returns a boolean for whether the given type is `never`.
225
+
226
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
227
+ @link https://stackoverflow.com/a/53984913/10292952
228
+ @link https://www.zhenghao.io/posts/ts-never
229
+
230
+ Useful in type utilities, such as checking if something does not occur.
231
+
232
+ @example
233
+ ```
234
+ import type {IsNever, And} from 'type-fest';
235
+
236
+ type A = IsNever<never>;
237
+ //=> true
238
+
239
+ type B = IsNever<any>;
240
+ //=> false
241
+
242
+ type C = IsNever<unknown>;
243
+ //=> false
244
+
245
+ type D = IsNever<never[]>;
246
+ //=> false
247
+
248
+ type E = IsNever<object>;
249
+ //=> false
250
+
251
+ type F = IsNever<string>;
252
+ //=> false
253
+ ```
254
+
255
+ @example
256
+ ```
257
+ import type {IsNever} from 'type-fest';
258
+
259
+ type IsTrue<T> = T extends true ? true : false;
260
+
261
+ // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
262
+ type A = IsTrue<never>;
263
+ //=> never
264
+
265
+ // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
266
+ type IsTrueFixed<T> =
267
+ IsNever<T> extends true ? false : T extends true ? true : false;
268
+
269
+ type B = IsTrueFixed<never>;
270
+ //=> false
271
+ ```
272
+
273
+ @category Type Guard
274
+ @category Utilities
275
+ */
276
+ type IsNever<T> = [T] extends [never] ? true : false;
277
+ //#endregion
278
+ //#region node_modules/type-fest/source/if.d.ts
279
+ /**
280
+ An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
281
+
282
+ Use-cases:
283
+ - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
284
+
285
+ Note:
286
+ - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
287
+ - Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
288
+
289
+ @example
290
+ ```
291
+ import type {If} from 'type-fest';
292
+
293
+ type A = If<true, 'yes', 'no'>;
294
+ //=> 'yes'
295
+
296
+ type B = If<false, 'yes', 'no'>;
297
+ //=> 'no'
298
+
299
+ type C = If<boolean, 'yes', 'no'>;
300
+ //=> 'yes' | 'no'
301
+
302
+ type D = If<any, 'yes', 'no'>;
303
+ //=> 'yes' | 'no'
304
+
305
+ type E = If<never, 'yes', 'no'>;
306
+ //=> 'no'
307
+ ```
308
+
309
+ @example
310
+ ```
311
+ import type {If, IsAny, IsNever} from 'type-fest';
312
+
313
+ type A = If<IsAny<unknown>, 'is any', 'not any'>;
314
+ //=> 'not any'
315
+
316
+ type B = If<IsNever<never>, 'is never', 'not never'>;
317
+ //=> 'is never'
318
+ ```
319
+
320
+ @example
321
+ ```
322
+ import type {If, IsEqual} from 'type-fest';
323
+
324
+ type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
325
+
326
+ type A = IfEqual<string, string, 'equal', 'not equal'>;
327
+ //=> 'equal'
328
+
329
+ type B = IfEqual<string, number, 'equal', 'not equal'>;
330
+ //=> 'not equal'
331
+ ```
332
+
333
+ Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
334
+
335
+ @example
336
+ ```
337
+ import type {If, IsEqual, StringRepeat} from 'type-fest';
338
+
339
+ type HundredZeroes = StringRepeat<'0', 100>;
340
+
341
+ // The following implementation is not tail recursive
342
+ type Includes<S extends string, Char extends string> =
343
+ S extends `${infer First}${infer Rest}`
344
+ ? If<IsEqual<First, Char>,
345
+ 'found',
346
+ Includes<Rest, Char>>
347
+ : 'not found';
348
+
349
+ // Hence, instantiations with long strings will fail
350
+ // @ts-expect-error
351
+ type Fails = Includes<HundredZeroes, '1'>;
352
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
353
+ // Error: Type instantiation is excessively deep and possibly infinite.
354
+
355
+ // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
356
+ type IncludesWithoutIf<S extends string, Char extends string> =
357
+ S extends `${infer First}${infer Rest}`
358
+ ? IsEqual<First, Char> extends true
359
+ ? 'found'
360
+ : IncludesWithoutIf<Rest, Char>
361
+ : 'not found';
362
+
363
+ // Now, instantiations with long strings will work
364
+ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
365
+ //=> 'not found'
366
+ ```
367
+
368
+ @category Type Guard
369
+ @category Utilities
370
+ */
371
+ type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
372
+ //#endregion
373
+ //#region node_modules/type-fest/source/simplify.d.ts
374
+ /**
375
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
376
+
377
+ @example
378
+ ```
379
+ import type {Simplify} from 'type-fest';
380
+
381
+ type PositionProps = {
382
+ top: number;
383
+ left: number;
384
+ };
385
+
386
+ type SizeProps = {
387
+ width: number;
388
+ height: number;
389
+ };
390
+
391
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
392
+ type Props = Simplify<PositionProps & SizeProps>;
393
+ ```
394
+
395
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
396
+
397
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
398
+
399
+ @example
400
+ ```
401
+ import type {Simplify} from 'type-fest';
402
+
403
+ interface SomeInterface {
404
+ foo: number;
405
+ bar?: string;
406
+ baz: number | undefined;
407
+ }
408
+
409
+ type SomeType = {
410
+ foo: number;
411
+ bar?: string;
412
+ baz: number | undefined;
413
+ };
414
+
415
+ const literal = {foo: 123, bar: 'hello', baz: 456};
416
+ const someType: SomeType = literal;
417
+ const someInterface: SomeInterface = literal;
418
+
419
+ declare function fn(object: Record<string, unknown>): void;
420
+
421
+ fn(literal); // Good: literal object type is sealed
422
+ fn(someType); // Good: type is sealed
423
+ // @ts-expect-error
424
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
425
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
426
+ ```
427
+
428
+ @link https://github.com/microsoft/TypeScript/issues/15300
429
+ @see {@link SimplifyDeep}
430
+ @category Object
431
+ */
432
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
433
+ //#endregion
434
+ //#region node_modules/type-fest/source/is-equal.d.ts
435
+ /**
436
+ Returns a boolean for whether the two given types are equal.
437
+
438
+ @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
439
+ @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
440
+
441
+ Use-cases:
442
+ - If you want to make a conditional branch based on the result of a comparison of two types.
443
+
444
+ @example
445
+ ```
446
+ import type {IsEqual} from 'type-fest';
447
+
448
+ // This type returns a boolean for whether the given array includes the given item.
449
+ // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
450
+ type Includes<Value extends readonly any[], Item> =
451
+ Value extends readonly [Value[0], ...infer rest]
452
+ ? IsEqual<Value[0], Item> extends true
453
+ ? true
454
+ : Includes<rest, Item>
455
+ : false;
456
+ ```
457
+
458
+ @category Type Guard
459
+ @category Utilities
460
+ */
461
+ type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
462
+ // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
463
+ type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
464
+ //#endregion
465
+ //#region node_modules/type-fest/source/omit-index-signature.d.ts
466
+ /**
467
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
468
+
469
+ This is the counterpart of `PickIndexSignature`.
470
+
471
+ Use-cases:
472
+ - Remove overly permissive signatures from third-party types.
473
+
474
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
475
+
476
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
477
+
478
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
479
+
480
+ ```
481
+ const indexed: Record<string, unknown> = {}; // Allowed
482
+
483
+ // @ts-expect-error
484
+ const keyed: Record<'foo', unknown> = {}; // Error
485
+ // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
486
+ ```
487
+
488
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
489
+
490
+ ```
491
+ type Indexed = {} extends Record<string, unknown>
492
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
493
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
494
+
495
+ type IndexedResult = Indexed;
496
+ //=> '✅ `{}` is assignable to `Record<string, unknown>`'
497
+
498
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
499
+ ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
500
+ : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
501
+
502
+ type KeyedResult = Keyed;
503
+ //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
504
+ ```
505
+
506
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
507
+
508
+ ```
509
+ type OmitIndexSignature<ObjectType> = {
510
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
511
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
512
+ };
513
+ ```
514
+
515
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
516
+
517
+ ```
518
+ type OmitIndexSignature<ObjectType> = {
519
+ [KeyType in keyof ObjectType
520
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
521
+ as {} extends Record<KeyType, unknown>
522
+ ? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
523
+ : KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
524
+ ]: ObjectType[KeyType];
525
+ };
526
+ ```
527
+
528
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
529
+
530
+ @example
531
+ ```
532
+ import type {OmitIndexSignature} from 'type-fest';
533
+
534
+ type Example = {
535
+ // These index signatures will be removed.
536
+ [x: string]: any;
537
+ [x: number]: any;
538
+ [x: symbol]: any;
539
+ [x: `head-${string}`]: string;
540
+ [x: `${string}-tail`]: string;
541
+ [x: `head-${string}-tail`]: string;
542
+ [x: `${bigint}`]: string;
543
+ [x: `embedded-${number}`]: string;
544
+
545
+ // These explicitly defined keys will remain.
546
+ foo: 'bar';
547
+ qux?: 'baz';
548
+ };
549
+
550
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
551
+ //=> {foo: 'bar'; qux?: 'baz'}
552
+ ```
553
+
554
+ @see {@link PickIndexSignature}
555
+ @category Object
556
+ */
557
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
558
+ //#endregion
559
+ //#region node_modules/type-fest/source/pick-index-signature.d.ts
560
+ /**
561
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
562
+
563
+ This is the counterpart of `OmitIndexSignature`.
564
+
565
+ @example
566
+ ```
567
+ import type {PickIndexSignature} from 'type-fest';
568
+
569
+ declare const symbolKey: unique symbol;
570
+
571
+ type Example = {
572
+ // These index signatures will remain.
573
+ [x: string]: unknown;
574
+ [x: number]: unknown;
575
+ [x: symbol]: unknown;
576
+ [x: `head-${string}`]: string;
577
+ [x: `${string}-tail`]: string;
578
+ [x: `head-${string}-tail`]: string;
579
+ [x: `${bigint}`]: string;
580
+ [x: `embedded-${number}`]: string;
581
+
582
+ // These explicitly defined keys will be removed.
583
+ ['kebab-case-key']: string;
584
+ [symbolKey]: string;
585
+ foo: 'bar';
586
+ qux?: 'baz';
587
+ };
588
+
589
+ type ExampleIndexSignature = PickIndexSignature<Example>;
590
+ // {
591
+ // [x: string]: unknown;
592
+ // [x: number]: unknown;
593
+ // [x: symbol]: unknown;
594
+ // [x: `head-${string}`]: string;
595
+ // [x: `${string}-tail`]: string;
596
+ // [x: `head-${string}-tail`]: string;
597
+ // [x: `${bigint}`]: string;
598
+ // [x: `embedded-${number}`]: string;
599
+ // }
600
+ ```
601
+
602
+ @see {@link OmitIndexSignature}
603
+ @category Object
604
+ */
605
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
606
+ //#endregion
607
+ //#region node_modules/type-fest/source/merge.d.ts
608
+ // Merges two objects without worrying about index signatures.
609
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
610
+ /**
611
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
612
+
613
+ This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`.
614
+
615
+ @example
616
+ ```
617
+ import type {Merge} from 'type-fest';
618
+
619
+ type Foo = {
620
+ a: string;
621
+ b: number;
622
+ };
623
+
624
+ type Bar = {
625
+ a: number; // Conflicts with Foo['a']
626
+ c: boolean;
627
+ };
628
+
629
+ // With `&`, `a` becomes `string & number` which is `never`. Not what you want.
630
+ type WithIntersection = (Foo & Bar)['a'];
631
+ //=> never
632
+
633
+ // With `Merge`, `a` is cleanly overridden to `number`.
634
+ type WithMerge = Merge<Foo, Bar>['a'];
635
+ //=> number
636
+ ```
637
+
638
+ @example
639
+ ```
640
+ import type {Merge} from 'type-fest';
641
+
642
+ type Foo = {
643
+ [x: string]: unknown;
644
+ [x: number]: unknown;
645
+ foo: string;
646
+ bar: symbol;
647
+ };
648
+
649
+ type Bar = {
650
+ [x: number]: number;
651
+ [x: symbol]: unknown;
652
+ bar: Date;
653
+ baz: boolean;
654
+ };
655
+
656
+ export type FooBar = Merge<Foo, Bar>;
657
+ //=> {
658
+ // [x: string]: unknown;
659
+ // [x: number]: number;
660
+ // [x: symbol]: unknown;
661
+ // foo: string;
662
+ // bar: Date;
663
+ // baz: boolean;
664
+ // }
665
+ ```
666
+
667
+ Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
668
+
669
+ @see {@link ObjectMerge}
670
+ @category Object
671
+ */
672
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
673
+ ? Source extends unknown // For distributing `Source`
674
+ ? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
675
+ : never;
676
+ // Should never happen
677
+ type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
678
+ //#endregion
679
+ //#region node_modules/type-fest/source/internal/object.d.ts
680
+ /**
681
+ Works similar to the built-in `Pick` utility type, except for the following differences:
682
+ - Distributes over union types and allows picking keys from any member of the union type.
683
+ - Primitives types are returned as-is.
684
+ - Picks all keys if `Keys` is `any`.
685
+ - Doesn't pick `number` from a `string` index signature.
686
+
687
+ @example
688
+ ```
689
+ type ImageUpload = {
690
+ url: string;
691
+ size: number;
692
+ thumbnailUrl: string;
693
+ };
694
+
695
+ type VideoUpload = {
696
+ url: string;
697
+ duration: number;
698
+ encodingFormat: string;
699
+ };
700
+
701
+ // Distributes over union types and allows picking keys from any member of the union type
702
+ type MediaDisplay = HomomorphicPick<ImageUpload | VideoUpload, "url" | "size" | "duration">;
703
+ //=> {url: string; size: number} | {url: string; duration: number}
704
+
705
+ // Primitive types are returned as-is
706
+ type Primitive = HomomorphicPick<string | number, 'toUpperCase' | 'toString'>;
707
+ //=> string | number
708
+
709
+ // Picks all keys if `Keys` is `any`
710
+ type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>;
711
+ //=> {a: 1; b: 2} | {c: 3}
712
+
713
+ // Doesn't pick `number` from a `string` index signature
714
+ type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>;
715
+ //=> {}
716
+ */
717
+ type HomomorphicPick<T, Keys extends KeysOfUnion<T>> = { [P in keyof T as Extract<P, Keys>]: T[P] };
718
+ /**
719
+ Merges user specified options with default options.
720
+
721
+ @example
722
+ ```
723
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
724
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
725
+ type SpecifiedOptions = {leavesOnly: true};
726
+
727
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
728
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
729
+ ```
730
+
731
+ @example
732
+ ```
733
+ // Complains if default values are not provided for optional options
734
+
735
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
736
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
737
+ type SpecifiedOptions = {};
738
+
739
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
740
+ // ~~~~~~~~~~~~~~~~~~~
741
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
742
+ ```
743
+
744
+ @example
745
+ ```
746
+ // Complains if an option's default type does not conform to the expected type
747
+
748
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
749
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
750
+ type SpecifiedOptions = {};
751
+
752
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
753
+ // ~~~~~~~~~~~~~~~~~~~
754
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
755
+ ```
756
+
757
+ @example
758
+ ```
759
+ // Complains if an option's specified type does not conform to the expected type
760
+
761
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
762
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
763
+ type SpecifiedOptions = {leavesOnly: 'yes'};
764
+
765
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
766
+ // ~~~~~~~~~~~~~~~~
767
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
768
+ ```
769
+ */
770
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
771
+ //#endregion
772
+ //#region node_modules/type-fest/source/except.d.ts
773
+ /**
774
+ Filter out keys from an object.
775
+
776
+ Returns `never` if `Exclude` is strictly equal to `Key`.
777
+ Returns `never` if `Key` extends `Exclude`.
778
+ Returns `Key` otherwise.
779
+
780
+ @example
781
+ ```
782
+ type Filtered = Filter<'foo', 'foo'>;
783
+ //=> never
784
+ ```
785
+
786
+ @example
787
+ ```
788
+ type Filtered = Filter<'bar', string>;
789
+ //=> never
790
+ ```
791
+
792
+ @example
793
+ ```
794
+ type Filtered = Filter<'bar', 'foo'>;
795
+ //=> 'bar'
796
+ ```
797
+
798
+ @see {Except}
799
+ */
800
+ type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
801
+ type ExceptOptions = {
802
+ /**
803
+ Disallow assigning non-specified properties.
804
+ Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
805
+ @default false
806
+ */
807
+ requireExactProps?: boolean;
808
+ };
809
+ type DefaultExceptOptions = {
810
+ requireExactProps: false;
811
+ };
812
+ /**
813
+ Create a type from an object type without certain keys.
814
+
815
+ We recommend setting the `requireExactProps` option to `true`.
816
+
817
+ This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
818
+
819
+ This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
820
+
821
+ @example
822
+ ```
823
+ import type {Except} from 'type-fest';
824
+
825
+ type Foo = {
826
+ a: number;
827
+ b: string;
828
+ };
829
+
830
+ type FooWithoutA = Except<Foo, 'a'>;
831
+ //=> {b: string}
832
+
833
+ // @ts-expect-error
834
+ const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
835
+ // errors: 'a' does not exist in type '{ b: string; }'
836
+
837
+ type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
838
+ //=> {a: number} & Partial<Record<'b', never>>
839
+
840
+ // @ts-expect-error
841
+ const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
842
+ // errors at 'b': Type 'string' is not assignable to type 'undefined'.
843
+
844
+ // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
845
+
846
+ // Consider the following example:
847
+
848
+ type UserData = {
849
+ [metadata: string]: string;
850
+ email: string;
851
+ name: string;
852
+ role: 'admin' | 'user';
853
+ };
854
+
855
+ // `Omit` clearly doesn't behave as expected in this case:
856
+ type PostPayload = Omit<UserData, 'email'>;
857
+ //=> {[x: string]: string; [x: number]: string}
858
+
859
+ // In situations like this, `Except` works better.
860
+ // It simply removes the `email` key while preserving all the other keys.
861
+ type PostPayloadFixed = Except<UserData, 'email'>;
862
+ //=> {[x: string]: string; name: string; role: 'admin' | 'user'}
863
+ ```
864
+
865
+ @category Object
866
+ */
867
+ type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
868
+ type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
869
+ //#endregion
870
+ //#region node_modules/type-fest/source/set-optional.d.ts
871
+ /**
872
+ Create a type that makes the given keys optional, while keeping the remaining keys as is.
873
+
874
+ Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
875
+
876
+ @example
877
+ ```
878
+ import type {SetOptional} from 'type-fest';
879
+
880
+ type Foo = {
881
+ a: number;
882
+ b?: string;
883
+ c: boolean;
884
+ };
885
+
886
+ type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
887
+ //=> {a: number; b?: string; c?: boolean}
888
+ ```
889
+
890
+ @category Object
891
+ */
892
+ type SetOptional<BaseType, Keys extends keyof BaseType> = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters<BaseType>) => ReturnType<BaseType> : unknown) & _SetOptional<BaseType, Keys>;
893
+ type _SetOptional<BaseType, Keys extends keyof BaseType> = BaseType extends unknown // To distribute `BaseType` when it's a union type.
894
+ ? Simplify< // Pick just the keys that are readonly from the base type.
895
+ Except<BaseType, Keys> // Pick the keys that should be mutable from the base type and make them mutable.
896
+ & Partial<HomomorphicPick<BaseType, Keys>>> : never;
897
+ //#endregion
898
+ //#region code/renderers/react/.dts-emit/code/renderers/react/src/types.d.ts
899
+ interface ReactRenderer extends WebRenderer {
900
+ component: ComponentType<this['T']>;
901
+ storyResult: StoryFnReactReturnType;
902
+ mount: (ui?: JSX.Element) => Promise<Canvas>;
903
+ }
904
+ interface ReactParameters {
905
+ /** React renderer configuration */
906
+ react?: {
907
+ /**
908
+ * Whether to enable React Server Components
909
+ *
910
+ * @see https://storybook.js.org/docs/get-started/frameworks/nextjs#react-server-components-rsc
911
+ */
912
+ rsc?: boolean; /** Options passed to React root creation */
913
+ rootOptions?: RootOptions;
914
+ };
915
+ }
916
+ interface ReactTypes extends ReactRenderer {
917
+ parameters: ReactParameters;
918
+ }
919
+ type StoryFnReactReturnType = JSX.Element;
920
+ //#endregion
921
+ //#region code/renderers/react/.dts-emit/code/renderers/react/src/public-types.d.ts
922
+ /**
923
+ * Metadata to configure the stories for a component.
924
+ *
925
+ * @see [Default export](https://storybook.js.org/docs/api/csf#default-export)
926
+ */
927
+ type Meta$1<TCmpOrArgs = Args> = [TCmpOrArgs] extends [ComponentType<any>] ? ComponentAnnotations<ReactRenderer, ComponentProps<TCmpOrArgs>> : ComponentAnnotations<ReactRenderer, TCmpOrArgs>;
928
+ /**
929
+ * Story function that represents a CSFv2 component example.
930
+ *
931
+ * @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
932
+ */
933
+ type StoryFn<TCmpOrArgs = Args> = [TCmpOrArgs] extends [ComponentType<any>] ? AnnotatedStoryFn<ReactRenderer, ComponentProps<TCmpOrArgs>> : AnnotatedStoryFn<ReactRenderer, TCmpOrArgs>;
934
+ /**
935
+ * Story object that represents a CSFv3 component example.
936
+ *
937
+ * @see [Named Story exports](https://storybook.js.org/docs/api/csf#named-story-exports)
938
+ */
939
+ type StoryObj<TMetaOrCmpOrArgs = Args> = [TMetaOrCmpOrArgs] extends [{
940
+ render?: ArgsStoryFn<ReactRenderer, any>;
941
+ component?: infer Component;
942
+ args?: infer DefaultArgs;
943
+ }] ? Simplify<(Component extends ComponentType<any> ? ComponentProps<Component> : unknown) & ArgsFromMeta<ReactRenderer, TMetaOrCmpOrArgs>> extends infer TArgs ? StoryAnnotations<ReactRenderer, AddMocks<TArgs, DefaultArgs>, SetOptional<TArgs, keyof TArgs & keyof DefaultArgs>> : never : TMetaOrCmpOrArgs extends ComponentType<any> ? StoryAnnotations<ReactRenderer, ComponentProps<TMetaOrCmpOrArgs>> : StoryAnnotations<ReactRenderer, TMetaOrCmpOrArgs>;
944
+ type AddMocks<TArgs, DefaultArgs> = Simplify<{ [T in keyof TArgs]: T extends keyof DefaultArgs ? DefaultArgs[T] extends ((...args: any) => any & {
945
+ mock: {};
946
+ }) ? DefaultArgs[T] : TArgs[T] : TArgs[T] }>;
947
+ type Decorator<TArgs = StrictArgs> = DecoratorFunction<ReactRenderer, TArgs>;
948
+ type Loader<TArgs = StrictArgs> = LoaderFunction<ReactRenderer, TArgs>;
949
+ type StoryContext$1<TArgs = StrictArgs> = StoryContext<ReactRenderer, TArgs>;
950
+ type Preview$1 = ProjectAnnotations<ReactRenderer>;
951
+ //#endregion
952
+ //#region code/renderers/react/.dts-emit/code/renderers/react/src/preview.d.ts
953
+ /** Extracts and unions all args types from an array of decorators. */
954
+ type DecoratorsArgs<TRenderer extends Renderer, Decorators> = UnionToIntersection<Decorators extends DecoratorFunction<TRenderer, infer TArgs> ? TArgs : unknown>;
955
+ type InferArgs<TArgs, T, Decorators> = Simplify<TArgs & Simplify<OmitIndexSignature<DecoratorsArgs<ReactTypes & T, Decorators>>>>;
956
+ type InferReactTypes<T, TArgs, Decorators> = ReactTypes & T & {
957
+ args: Simplify<InferArgs<TArgs, T, Decorators>>;
958
+ };
959
+ /**
960
+ * Creates a React-specific preview configuration with CSF factories support.
961
+ *
962
+ * This function wraps the base `definePreview` and adds React-specific annotations for rendering
963
+ * and documentation. It returns a `ReactPreview` that provides type-safe `meta()` and `story()`
964
+ * factory methods.
965
+ *
966
+ * @example
967
+ *
968
+ * ```ts
969
+ * // .storybook/preview.ts
970
+ * import { definePreview } from '@storybook/react';
971
+ *
972
+ * export const preview = definePreview({
973
+ * addons: [],
974
+ * parameters: { layout: 'centered' },
975
+ * });
976
+ * ```
977
+ */
978
+ declare function __definePreview<Addons extends PreviewAddon<never>[]>(input: {
979
+ addons: Addons;
980
+ } & ProjectAnnotations<ReactTypes & InferTypes<Addons>>): ReactPreview<ReactTypes & InferTypes<Addons>>;
981
+ /**
982
+ * React-specific Preview interface that provides type-safe CSF factory methods.
983
+ *
984
+ * Use `preview.meta()` to create a meta configuration for a component, and then `meta.story()` to
985
+ * create individual stories. The type system will infer args from the component props, decorators,
986
+ * and any addon types.
987
+ *
988
+ * @example
989
+ *
990
+ * ```ts
991
+ * const meta = preview.meta({ component: Button });
992
+ * export const Primary = meta.story({ args: { label: 'Click me' } });
993
+ * ```
994
+ */
995
+ /** @ts-expect-error We cannot implement the meta faithfully here, but that is okay. */
996
+ interface ReactPreview<T extends AddonTypes> extends Preview<ReactTypes & T> {
997
+ /**
998
+ * Narrows the type of the preview to include additional type information. This is useful when you
999
+ * need to add args that aren't inferred from the component.
1000
+ *
1001
+ * @example
1002
+ *
1003
+ * ```ts
1004
+ * const meta = preview.type<{ args: { theme: 'light' | 'dark' } }>().meta({
1005
+ * component: Button,
1006
+ * });
1007
+ * ```
1008
+ */
1009
+ type<R>(): ReactPreview<T & R>;
1010
+ meta<TArgs extends Args, Decorators extends DecoratorFunction<ReactTypes & T, any>, TMetaArgs extends Partial<TArgs & T['args']>>(meta: {
1011
+ render?: ArgsStoryFn<ReactTypes & T, TArgs & T['args']>;
1012
+ component?: ComponentType<TArgs>;
1013
+ decorators?: Decorators | Decorators[];
1014
+ args?: TMetaArgs;
1015
+ } & Omit<ComponentAnnotations<ReactTypes & T, TArgs>, 'decorators' | 'component' | 'args' | 'render'>): ReactMeta<InferReactTypes<T, TArgs, Decorators>, Omit<ComponentAnnotations<InferReactTypes<T, TArgs, Decorators>>, 'args'> & {
1016
+ args: Partial<TArgs> extends TMetaArgs ? {} : TMetaArgs;
1017
+ }>;
1018
+ }
1019
+ /**
1020
+ * React-specific Meta interface returned by `preview.meta()`.
1021
+ *
1022
+ * Provides the `story()` method to create individual stories with proper type inference. Args
1023
+ * provided in meta become optional in stories, while missing required args must be provided at the
1024
+ * story level.
1025
+ */
1026
+ interface ReactMeta<T extends ReactTypes, MetaInput extends ComponentAnnotations<T>> /** @ts-expect-error ReactMeta requires two type parameters, but Meta's constraints differ */ extends Meta<T, MetaInput> {
1027
+ /**
1028
+ * Creates a story with a custom render function that takes no args.
1029
+ *
1030
+ * This overload allows you to define a story using just a render function or an object with a
1031
+ * render function that doesn't depend on args. Since the render function doesn't use args, no
1032
+ * args need to be provided regardless of what's required by the component.
1033
+ *
1034
+ * @example
1035
+ *
1036
+ * ```ts
1037
+ * // Using just a render function
1038
+ * export const CustomRender = meta.story(() => <div>Custom content</div>);
1039
+ *
1040
+ * // Using an object with render
1041
+ * export const WithRender = meta.story({
1042
+ * render: () => <MyComponent prop="static" />,
1043
+ * });
1044
+ * ```
1045
+ */
1046
+ story<TInput extends (() => ReactTypes['storyResult']) | (StoryAnnotations<T, T['args']> & {
1047
+ render: () => ReactTypes['storyResult'];
1048
+ })>(story: TInput): ReactStory<T, TInput extends (() => ReactTypes['storyResult']) ? {
1049
+ render: TInput;
1050
+ } : TInput>;
1051
+ /**
1052
+ * Creates a story with custom configuration including args, decorators, or other annotations.
1053
+ *
1054
+ * This is the primary overload for defining stories. Args that were already provided in meta
1055
+ * become optional, while any remaining required args must be specified here.
1056
+ *
1057
+ * @example
1058
+ *
1059
+ * ```ts
1060
+ * // Provide required args not in meta
1061
+ * export const Primary = meta.story({
1062
+ * args: { label: 'Click me', disabled: false },
1063
+ * });
1064
+ *
1065
+ * // Override meta args and add story-specific configuration
1066
+ * export const Disabled = meta.story({
1067
+ * args: { disabled: true },
1068
+ * decorators: [withCustomWrapper],
1069
+ * });
1070
+ * ```
1071
+ */
1072
+ story<TInput extends Simplify<StoryAnnotations<T, AddMocks<T['args'], MetaInput['args']>, SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']>>>>(story: TInput /** @ts-expect-error hard */): ReactStory<T, TInput>;
1073
+ /**
1074
+ * Creates a story with no additional configuration.
1075
+ *
1076
+ * This overload is only available when all required args have been provided in meta. The
1077
+ * conditional type `Partial<T['args']> extends SetOptional<...>` checks if the remaining required
1078
+ * args (after accounting for args provided in meta) are all optional. If so, the function accepts
1079
+ * zero arguments `[]`. Otherwise, it requires `[never]` which makes this overload unmatchable,
1080
+ * forcing the user to provide args.
1081
+ *
1082
+ * @example
1083
+ *
1084
+ * ```ts
1085
+ * // When meta provides all required args, story() can be called with no arguments
1086
+ * const meta = preview.meta({ component: Button, args: { label: 'Hi', disabled: false } });
1087
+ * export const Default = meta.story(); // Valid - all args provided in meta
1088
+ * ```
1089
+ */
1090
+ story(..._args: Partial<T['args']> extends SetOptional<T['args'], keyof T['args'] & keyof MetaInput['args']> ? [] : [never]): ReactStory<T, {}>;
1091
+ }
1092
+ /**
1093
+ * React-specific Story interface returned by `meta.story()`.
1094
+ *
1095
+ * Represents a single story with its configuration and provides access to the composed story for
1096
+ * testing via `story.run()`.
1097
+ *
1098
+ * Also includes a `Component` property for portable story compatibility.
1099
+ */
1100
+ interface ReactStory<T extends ReactTypes, TInput extends StoryAnnotations<T, T['args']>> extends Story<T, TInput> {
1101
+ Component: ComponentType<Partial<T['args']>>;
1102
+ }
1103
+ //#endregion
1104
+ export { ReactRenderer as _, AddMocks as a, Decorator as c, Parameters$1 as d, Preview$1 as f, StrictArgs$1 as g, StoryObj as h, __definePreview as i, Loader as l, StoryFn as m, ReactPreview as n, ArgTypes as o, StoryContext$1 as p, ReactStory as r, Args$1 as s, ReactMeta as t, Meta$1 as u, ReactTypes as v };