zod-v3-to-v4 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/convert-zod-errors.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -131,6 +131,7 @@ pnpm playground:interactive
|
|
|
131
131
|
<tr>
|
|
132
132
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yann-combarnous"><img src="https://avatars.githubusercontent.com/u/39089766?v=4?s=100" width="100px;" alt="yann-combarnous"/><br /><sub><b>yann-combarnous</b></sub></a><br /><a href="https://github.com/nicoespeon/zod-v3-to-v4/issues?q=author%3Ayann-combarnous" title="Bug reports">🐛</a></td>
|
|
133
133
|
<td align="center" valign="top" width="14.28%"><a href="http://adam.doussan.info"><img src="https://avatars.githubusercontent.com/u/26745150?v=4?s=100" width="100px;" alt="acdoussan"/><br /><sub><b>acdoussan</b></sub></a><br /><a href="https://github.com/nicoespeon/zod-v3-to-v4/issues?q=author%3Aacdoussan" title="Bug reports">🐛</a></td>
|
|
134
|
+
<td align="center" valign="top" width="14.28%"><a href="http://matsjfunke.com"><img src="https://avatars.githubusercontent.com/u/125814808?v=4?s=100" width="100px;" alt="Mats Julius Funke"/><br /><sub><b>Mats Julius Funke</b></sub></a><br /><a href="#ideas-matsjfunke" title="Ideas, Planning, & Feedback">🤔</a></td>
|
|
134
135
|
</tr>
|
|
135
136
|
</tbody>
|
|
136
137
|
<tfoot>
|
|
@@ -187,6 +187,13 @@ export function convertZodErrorAddIssueToDirectPushes(sourceFile, zodName) {
|
|
|
187
187
|
: argument.getText();
|
|
188
188
|
expression.replaceWithText(`${caller}.issues.push(${newArgument})`);
|
|
189
189
|
});
|
|
190
|
+
sourceFile
|
|
191
|
+
.getDescendantsOfKind(SyntaxKind.PropertyAccessExpression)
|
|
192
|
+
.filter((expression) => isZodReference(zodName, ["ZodType", "ZodError"], expression))
|
|
193
|
+
.filter((expression) => expression.getName() === "errors")
|
|
194
|
+
.forEach((expression) => {
|
|
195
|
+
expression.getNameNode().replaceWithText("issues");
|
|
196
|
+
});
|
|
190
197
|
}
|
|
191
198
|
function convertZodIssueToV4(node) {
|
|
192
199
|
if (node.isKind(SyntaxKind.ArrayLiteralExpression)) {
|