-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.3.0 - types and comments refactoring
- Loading branch information
Showing
12 changed files
with
603 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export type HoneyFormFieldName = string; | ||
|
||
export type HoneyFormId = string; | ||
|
||
/** | ||
* Defines the structure of a basic form where each field is identified by a name and holds a value. | ||
* | ||
* This type is a generic representation of a form where field names are strings, and field values | ||
* can be of any type. It serves as a base type for defining more specific forms with defined field types. | ||
*/ | ||
export type HoneyFormBaseForm = Record<HoneyFormFieldName, unknown>; | ||
|
||
/** | ||
* Represents a child form that inherits the structure of a basic form. | ||
* | ||
* This type is used to define forms that are nested within a parent form. It is essentially the same | ||
* as `HoneyFormBaseForm`, indicating that child forms follow the same structure as the base form. | ||
*/ | ||
export type ChildHoneyFormBaseForm = HoneyFormBaseForm; | ||
|
||
/** | ||
* Defines the possible values for each field in a form, allowing for fields to be `undefined`. | ||
* | ||
* The type maps each field name to either its value or `undefined`. This is useful when a field's value | ||
* may not be set or initialized, allowing for flexibility in handling default values or optional fields. | ||
* | ||
* @template Form - The type representing the structure of the entire form. | ||
*/ | ||
export type HoneyFormValues<Form extends HoneyFormBaseForm> = { | ||
[FieldName in keyof Form]: Form[FieldName] | undefined; | ||
}; |
Oops, something went wrong.