-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a375897
commit 6d20865
Showing
3 changed files
with
126 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,33 @@ | ||
export type ParameterType = 'Integer' | 'String' | 'Boolean'; | ||
interface IntegerParameter { | ||
Integer: { | ||
value: number; | ||
min?: number; | ||
max?: number; | ||
}; | ||
} | ||
|
||
export type ParameterOption<T extends ParameterType> = T extends 'Integer' | ||
? { Integer: { value: number; min: number; max: number } } | ||
: T extends 'String' | ||
? { String: { value: string } } | ||
: T extends 'Boolean' | ||
? { Boolean: { value: boolean } } | ||
: never; | ||
interface StringParameter { | ||
String: { | ||
value: string; | ||
}; | ||
} | ||
|
||
export type ParameterEntry<T extends ParameterType> = { | ||
interface BooleanParameter { | ||
Boolean: { | ||
value: boolean; | ||
}; | ||
} | ||
|
||
// TODO - In practice, use as IntegerParameter | StringParameter | BooleanParameter | ||
type Parameter = IntegerParameter & StringParameter & BooleanParameter; | ||
|
||
interface ParamsOptionItem { | ||
parameter: Parameter; | ||
description: string; | ||
required: string; | ||
parameter: ParameterOption<T>; | ||
}; | ||
} | ||
|
||
export type Parameters = { | ||
items: { [key: string]: ParameterEntry<ParameterType> }; | ||
}; | ||
export interface ParamsOption { | ||
items: { | ||
[key: string]: ParamsOptionItem; | ||
}; | ||
} |
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