refactor(file): use Schema.Literals
This commit is contained in:
parent
e34bbb394d
commit
8baf829f97
1 changed files with 3 additions and 3 deletions
|
|
@ -22,7 +22,7 @@ export namespace File {
|
||||||
path: Schema.String,
|
path: Schema.String,
|
||||||
added: Schema.Number,
|
added: Schema.Number,
|
||||||
removed: Schema.Number,
|
removed: Schema.Number,
|
||||||
status: Schema.Union([Schema.Literal("added"), Schema.Literal("deleted"), Schema.Literal("modified")]),
|
status: Schema.Literals(["added", "deleted", "modified"]),
|
||||||
}) {
|
}) {
|
||||||
static readonly zod = zod(this)
|
static readonly zod = zod(this)
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ export namespace File {
|
||||||
name: Schema.String,
|
name: Schema.String,
|
||||||
path: Schema.String,
|
path: Schema.String,
|
||||||
absolute: Schema.String,
|
absolute: Schema.String,
|
||||||
type: Schema.Union([Schema.Literal("file"), Schema.Literal("directory")]),
|
type: Schema.Literals(["file", "directory"]),
|
||||||
ignored: Schema.Boolean,
|
ignored: Schema.Boolean,
|
||||||
}) {
|
}) {
|
||||||
static readonly zod = zod(this)
|
static readonly zod = zod(this)
|
||||||
|
|
@ -59,7 +59,7 @@ export namespace File {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Content extends Schema.Class<Content>("FileContent")({
|
export class Content extends Schema.Class<Content>("FileContent")({
|
||||||
type: Schema.Union([Schema.Literal("text"), Schema.Literal("binary")]),
|
type: Schema.Literals(["text", "binary"]),
|
||||||
content: Schema.String,
|
content: Schema.String,
|
||||||
diff: Schema.optional(Schema.String),
|
diff: Schema.optional(Schema.String),
|
||||||
patch: Schema.optional(Patch),
|
patch: Schema.optional(Patch),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue