Skip to content

Commit

Permalink
Fixed the type of the ArgType (#441)
Browse files Browse the repository at this point in the history
Co-authored-by: Vojtech Miksu <[email protected]>
  • Loading branch information
calloc134 and tajo authored Sep 2, 2023
1 parent 016a005 commit 1b048c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
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

1 comment on commit 1b048c4

@vercel
Copy link

@vercel vercel bot commented on 1b048c4 Sep 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ladle – ./

ladle.vercel.app
ladle-git-main-miksu.vercel.app
ladle.dev
ladle-miksu.vercel.app

Please sign in to comment.