Skip to content

Commit

Permalink
Merge pull request #57 from ComponentDriven/kasper/stricter-variants
Browse files Browse the repository at this point in the history
Add strict variants for Args and Paramters to CSF
  • Loading branch information
kasperpeulen authored Nov 14, 2022
2 parents 0819d9f + a8fc7a0 commit a8deeb1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export interface Parameters {
[name: string]: any;
}

export interface StrictParameters {
[name: string]: unknown;
}

type ConditionalTest = { truthy?: boolean } | { exists: boolean } | { eq: any } | { neq: any };
type ConditionalValue = { arg: string } | { global: string };
export type Conditional = ConditionalValue & ConditionalTest;
Expand All @@ -47,7 +51,14 @@ export interface StrictInputType extends InputType {
type?: SBType;
}

export type Args = { [name: string]: any };
export interface Args {
[name: string]: any;
}

export interface StrictArgs {
[name: string]: unknown;
}

export type ArgTypes<TArgs = Args> = { [name in keyof TArgs]: InputType };
export type StrictArgTypes<TArgs = Args> = { [name in keyof TArgs]: StrictInputType };

Expand Down

0 comments on commit a8deeb1

Please sign in to comment.