zod-v3-to-v4 1.7.0 → 1.7.1
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/dist/convert-zod-errors.js +3 -3
- package/dist/migrate.js +1 -1
- package/package.json +1 -1
|
@@ -130,7 +130,7 @@ export function convertDeprecatedErrorKeysToErrorFunction(node) {
|
|
|
130
130
|
export function convertZodErrorToTreeifyError(sourceFile, zodName) {
|
|
131
131
|
sourceFile
|
|
132
132
|
.getDescendantsOfKind(SyntaxKind.CallExpression)
|
|
133
|
-
.filter((expression) => isZodReference(zodName, ["
|
|
133
|
+
.filter((expression) => isZodReference(zodName, ["ZodType", "ZodError"], expression))
|
|
134
134
|
.filter((expression) => {
|
|
135
135
|
const argsCount = expression.getArguments().length;
|
|
136
136
|
const methodCalled = expression.getExpression().getLastChild();
|
|
@@ -150,7 +150,7 @@ export function convertZodErrorToTreeifyError(sourceFile, zodName) {
|
|
|
150
150
|
});
|
|
151
151
|
sourceFile
|
|
152
152
|
.getDescendantsOfKind(SyntaxKind.PropertyAccessExpression)
|
|
153
|
-
.filter((expression) => isZodReference(zodName, ["
|
|
153
|
+
.filter((expression) => isZodReference(zodName, ["ZodType", "ZodError"], expression))
|
|
154
154
|
.filter((expression) => {
|
|
155
155
|
const looksLikeZodErrorFormErrors = expression.getName() === "formErrors";
|
|
156
156
|
const looksLikeZodErrorFieldErrors = expression.getName() === "fieldErrors";
|
|
@@ -164,7 +164,7 @@ export function convertZodErrorToTreeifyError(sourceFile, zodName) {
|
|
|
164
164
|
export function convertZodErrorAddIssueToDirectPushes(sourceFile, zodName) {
|
|
165
165
|
sourceFile
|
|
166
166
|
.getDescendantsOfKind(SyntaxKind.CallExpression)
|
|
167
|
-
.filter((expression) => isZodReference(zodName, ["
|
|
167
|
+
.filter((expression) => isZodReference(zodName, ["ZodType", "ZodError"], expression))
|
|
168
168
|
.filter((expression) => {
|
|
169
169
|
const argsCount = expression.getArguments().length;
|
|
170
170
|
const methodCalled = expression.getExpression().getLastChild();
|
package/dist/migrate.js
CHANGED
|
@@ -23,7 +23,7 @@ export function migrateZodV3ToV4(sourceFile, options = {}) {
|
|
|
23
23
|
}
|
|
24
24
|
const parentType = node.getFirstAncestorByKind(SyntaxKind.QualifiedName);
|
|
25
25
|
if (parentType?.getText().endsWith("ZodSchema")) {
|
|
26
|
-
parentType?.getRight().replaceWithText("
|
|
26
|
+
parentType?.getRight().replaceWithText("ZodType");
|
|
27
27
|
}
|
|
28
28
|
const parentStatement = node.getParentWhile(isZodNode) || node;
|
|
29
29
|
if (!isZodNode(parentStatement)) {
|