Skip to content

Commit 97e36ff

Browse files
committed
updated Select stories according to new type
1 parent 393cdd3 commit 97e36ff

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

stories/Select.stories.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { getStoryFactory } from "./getStory";
44
import { assert } from "tsafe/assert";
55
import type { Equals } from "tsafe";
66

7-
const { meta, getStory } = getStoryFactory({
7+
const { meta, getStory } = getStoryFactory<
8+
SelectProps<GenericOption<string | number | MyFakeValue>[]>
9+
>({
810
sectionName,
911
"wrappedComponent": { Select },
1012
"description": `
@@ -100,7 +102,7 @@ function MyComponent(){
100102
assert<
101103
Equals<
102104
typeof options[number],
103-
NonNullable<SelectProps<typeof options[number]>["state"]>
105+
NonNullable<SelectProps<GenericOption<typeof options[number]>[]>["state"]>
104106
>
105107
>();
106108

@@ -140,12 +142,12 @@ const myFakeValueSet = [
140142
"66a9d7ac-9b25-4e52-9de3-4b7238135b39"
141143
] as const;
142144

143-
const optionsWithTypedValues: GenericOption<typeof myFakeValueSet[number]>[] = myFakeValueSet.map(
144-
fakeValue => ({
145-
value: fakeValue,
146-
label: fakeValue
147-
})
148-
);
145+
type MyFakeValue = typeof myFakeValueSet[number];
146+
147+
const optionsWithTypedValues: GenericOption<MyFakeValue>[] = myFakeValueSet.map(fakeValue => ({
148+
value: fakeValue,
149+
label: fakeValue
150+
}));
149151

150152
export const Default = getStory({
151153
"label": "Label pour liste déroulante",

0 commit comments

Comments
 (0)