mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 04:11:57 +00:00
add file and update type for valueSpecListOf
This commit is contained in:
@@ -7,6 +7,7 @@ export type ValueType =
|
|||||||
| "enum"
|
| "enum"
|
||||||
| "list"
|
| "list"
|
||||||
| "object"
|
| "object"
|
||||||
|
| "file"
|
||||||
| "union";
|
| "union";
|
||||||
export type ValueSpec = ValueSpecOf<ValueType>;
|
export type ValueSpec = ValueSpecOf<ValueType>;
|
||||||
|
|
||||||
@@ -23,6 +24,8 @@ export type ValueSpecOf<T extends ValueType> = T extends "string"
|
|||||||
? ValueSpecList
|
? ValueSpecList
|
||||||
: T extends "object"
|
: T extends "object"
|
||||||
? ValueSpecObject
|
? ValueSpecObject
|
||||||
|
: T extends "file"
|
||||||
|
? ValueSpecFile
|
||||||
: T extends "union"
|
: T extends "union"
|
||||||
? ValueSpecUnion
|
? ValueSpecUnion
|
||||||
: never;
|
: never;
|
||||||
@@ -57,6 +60,13 @@ export interface ValueSpecUnion {
|
|||||||
default: string;
|
default: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ValueSpecFile extends WithStandalone {
|
||||||
|
type: 'file';
|
||||||
|
placeholder: null | string;
|
||||||
|
nullable: boolean;
|
||||||
|
extensions: string[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface ValueSpecObject extends WithStandalone {
|
export interface ValueSpecObject extends WithStandalone {
|
||||||
type: "object";
|
type: "object";
|
||||||
spec: InputSpec;
|
spec: InputSpec;
|
||||||
@@ -101,11 +111,11 @@ export interface ValueSpecListOf<T extends ListValueSpecType>
|
|||||||
| string[]
|
| string[]
|
||||||
| number[]
|
| number[]
|
||||||
| DefaultString[]
|
| DefaultString[]
|
||||||
| object[]
|
| Record<string, unknown>[]
|
||||||
| readonly string[]
|
| readonly string[]
|
||||||
| readonly number[]
|
| readonly number[]
|
||||||
| readonly DefaultString[]
|
| readonly DefaultString[]
|
||||||
| readonly object[];
|
| readonly Record<string, unknown>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// sometimes the type checker needs just a little bit of help
|
// sometimes the type checker needs just a little bit of help
|
||||||
|
|||||||
Reference in New Issue
Block a user