Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/kind-fans-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ladle/react": patch
---

Fixed the type of the "ArgType" object so that options are properly loaded into the type
2 changes: 1 addition & 1 deletion packages/ladle/lib/app/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export type ControlType =
export interface ArgType<K = any> {
control?: {
name?: string;
options?: K[];
labels?: { [key: string]: string };
type: ControlType;
min?: number;
Expand All @@ -114,6 +113,7 @@ export interface ArgType<K = any> {
[key: string]: any;
};
mapping?: { [key: string | number]: any };
options?: K[] | unknown;
defaultValue?: K;
description?: string;
name?: string;
Expand Down
6 changes: 1 addition & 5 deletions type-tests/argTypes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ ArgTypes.argTypes = {
foo: {
control: {
type: "select",
options: [
"foo",
// @ts-expect-error - 1 is not a string
5,
],
options: ["foo", 5],
},
},
bar: {
Expand Down