Skip to content

Commit

Permalink
feat(vae): parse 失败时返回 message
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Jan 11, 2024
1 parent 600c7ba commit 866901c
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/** @type import('haoma').ESLintConfig */
module.exports = require('haoma').getESLintConfig()
module.exports = require('haoma').getESLintConfig({
rules: {
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
},
})
5 changes: 5 additions & 0 deletions src/vae/VaeSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export type VaeSchemaParseResult<T> =
| {
success: false
issues: VaeIssue[]
message: string
}

export type VaeSchemaOf<T0, T extends NonNullable<T0> = NonNullable<T0>> = // 为何要加 []
Expand Down Expand Up @@ -423,6 +424,7 @@ export abstract class VaeSchema<
return {
success: false,
issues: ctx.issues,
message: ctx.issues[0].message,
}
}
}
Expand All @@ -441,6 +443,7 @@ export abstract class VaeSchema<
return {
success: false,
issues: ctx.issues,
message: ctx.issues[0].message,
}
}
}
Expand Down Expand Up @@ -484,6 +487,7 @@ export abstract class VaeSchema<
return {
success: false,
issues: ctx.issues,
message: ctx.issues[0].message,
}
}
}
Expand All @@ -498,6 +502,7 @@ export abstract class VaeSchema<
return {
success: false,
issues: ctx.issues,
message: ctx.issues[0].message,
}
}
return {
Expand Down

0 comments on commit 866901c

Please sign in to comment.