add file and update type for valueSpecListOf

This commit is contained in:
Matt Hill
2023-03-20 16:01:52 -06:00
parent 4f480c4e94
commit 26b10cc4c6

View File

@@ -7,6 +7,7 @@ export type ValueType =
| "enum"
| "list"
| "object"
| "file"
| "union";
export type ValueSpec = ValueSpecOf<ValueType>;
@@ -23,6 +24,8 @@ export type ValueSpecOf<T extends ValueType> = T extends "string"
? ValueSpecList
: T extends "object"
? ValueSpecObject
: T extends "file"
? ValueSpecFile
: T extends "union"
? ValueSpecUnion
: never;
@@ -57,6 +60,13 @@ export interface ValueSpecUnion {
default: string;
}
export interface ValueSpecFile extends WithStandalone {
type: 'file';
placeholder: null | string;
nullable: boolean;
extensions: string[];
}
export interface ValueSpecObject extends WithStandalone {
type: "object";
spec: InputSpec;
@@ -101,11 +111,11 @@ export interface ValueSpecListOf<T extends ListValueSpecType>
| string[]
| number[]
| DefaultString[]
| object[]
| Record<string, unknown>[]
| readonly string[]
| readonly number[]
| readonly DefaultString[]
| readonly object[];
| readonly Record<string, unknown>[];
}
// sometimes the type checker needs just a little bit of help