Skip to content

Commit

Permalink
Merge pull request #24 from elek-io/export-type-definitions-for-speci…
Browse files Browse the repository at this point in the history
…fic-value-definitions

Exporting some type definitions for specific Value definitions
  • Loading branch information
Nils-Kolvenbach authored Apr 7, 2024
2 parents 5964418 + 38cb706 commit 72fde12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-crews-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@elek-io/shared': patch
---

Exporting some type definitions for specific Value definitions
7 changes: 7 additions & 0 deletions src/valueSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ export const textValueDefinitionSchema = StringValueDefinitionBaseSchema.extend(
inputType: z.literal(ValueInputTypeSchema.Enum.text),
}
);
export type TextValueDefinition = z.infer<typeof textValueDefinitionSchema>;

export const textareaValueDefinitionSchema =
StringValueDefinitionBaseSchema.extend({
inputType: z.literal(ValueInputTypeSchema.Enum.textarea),
});
export type TextareaValueDefinition = z.infer<
typeof textareaValueDefinitionSchema
>;

export const emailValueDefinitionSchema =
StringValueDefinitionBaseSchema.extend({
Expand Down Expand Up @@ -150,6 +154,7 @@ export const numberValueDefinitionSchema =
NumberValueDefinitionBaseSchema.extend({
inputType: z.literal(ValueInputTypeSchema.Enum.number),
});
export type NumberValueDefinition = z.infer<typeof numberValueDefinitionSchema>;

export const rangeValueDefinitionSchema =
NumberValueDefinitionBaseSchema.extend({
Expand All @@ -158,6 +163,7 @@ export const rangeValueDefinitionSchema =
min: z.number(),
max: z.number(),
});
export type RangeValueDefinition = z.infer<typeof rangeValueDefinitionSchema>;

/**
* Boolean based Values
Expand All @@ -173,6 +179,7 @@ export const toggleValueDefinitionSchema =
BooleanValueDefinitionBaseSchema.extend({
inputType: z.literal(ValueInputTypeSchema.Enum.toggle),
});
export type ToggleValueDefinition = z.infer<typeof toggleValueDefinitionSchema>;

/**
* Reference based Values
Expand Down

0 comments on commit 72fde12

Please sign in to comment.