You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i want to set Error on server error for the field in Array. Given the current structure of setError, which expects a specific set of keys, it seems the nested keys like "renderers_image.env[${number}].path" are not directly compatible with the keys expected by setError. How can I fix it this is my set error function if (errorList) {
errorList.forEach((error) => {
if (error.loc && error.loc.length > 0 && error.loc[0] === "body") {
if (error.loc.length === 2) {
setError(error.loc[1], { message: error.msg });
}
if (error.loc.length === 3 && error.loc[1] === "renderers_image") {
const field: string = error.loc[2];
if (
field === "type" ||
field === "template" ||
field === "rest_resp_template" ||
field === "env"
) {
setError(renderers_image.${field}, { message: error.msg });
}
}
if (error.loc.length === 4) {
return;
}
if (error.loc.length === 5 && error.loc[1] === "renderers_image") {
const field: string = error.loc[2];
if (field === "env") {
const index = Number(error.loc[3]);
const subField: "from_section" | "path" | "alias" = error
.loc[4] as "from_section" | "path" | "alias";
if (
!isNaN(index) &&
(subField === "from_section" ||
subField === "path" ||
subField === "alias")
) {
setError(renderers_image.env[${index}].${subField}, {
type: "server",
message: error.msg,
});
}
}
}
}
});
} i have type error for setError(renderers_image.env[${index}].${subField} Argument of type 'renderers_image.env[${number}].path | renderers_image.env[${number}].from_section | renderers_image.env[${number}].alias' is not assignable to parameter of type '"labels" | "name" | "title" | "description" | "tags" | "volumes" | "configs" | "variables" | "renderers_image" | "renderers_env_file" | "ports_remote_services" | "ports_listening_ports" | ... 178 more ... | ports_listening_ports.${number}.functionalities.${number}.action'.
Type 'renderers_image.env[${number}].path' is not assignable to type '"labels" | "name" | "title" | "description" | "tags" | "volumes" | "configs" | "variables" | "renderers_image" | "renderers_env_file" | "ports_remote_services" | "ports_listening_ports" | ... 178 more ... | ports_listening_ports.${number}.functionalities.${number}.action'. were the const methods = useForm({
resolver: yupResolver(Validation(t)),
mode: "onBlur",
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
i want to set Error on server error for the field in Array. Given the current structure of setError, which expects a specific set of keys, it seems the nested keys like "renderers_image.env[${number}].path" are not directly compatible with the keys expected by setError. How can I fix it this is my set error function if (errorList) {
errorList.forEach((error) => {
if (error.loc && error.loc.length > 0 && error.loc[0] === "body") {
if (error.loc.length === 2) {
setError(error.loc[1], { message: error.msg });
}
if (error.loc.length === 3 && error.loc[1] === "renderers_image") {
const field: string = error.loc[2];
if (
field === "type" ||
field === "template" ||
field === "rest_resp_template" ||
field === "env"
) {
setError(
renderers_image.${field}
, { message: error.msg });}
}
if (error.loc.length === 4) {
return;
}
if (error.loc.length === 5 && error.loc[1] === "renderers_image") {
const field: string = error.loc[2];
if (field === "env") {
const index = Number(error.loc[3]);
const subField: "from_section" | "path" | "alias" = error
.loc[4] as "from_section" | "path" | "alias";
if (
!isNaN(index) &&
(subField === "from_section" ||
subField === "path" ||
subField === "alias")
) {
setError(
renderers_image.env[${index}].${subField}
, {type: "server",
message: error.msg,
});
}
}
}
}
});
} i have type error for setError(
renderers_image.env[${index}].${subField}
Argument of type 'renderers_image.env[${number}].path
|renderers_image.env[${number}].from_section
|renderers_image.env[${number}].alias
' is not assignable to parameter of type '"labels" | "name" | "title" | "description" | "tags" | "volumes" | "configs" | "variables" | "renderers_image" | "renderers_env_file" | "ports_remote_services" | "ports_listening_ports" | ... 178 more ... |ports_listening_ports.${number}.functionalities.${number}.action
'.Type '
renderers_image.env[${number}].path
' is not assignable to type '"labels" | "name" | "title" | "description" | "tags" | "volumes" | "configs" | "variables" | "renderers_image" | "renderers_env_file" | "ports_remote_services" | "ports_listening_ports" | ... 178 more ... |ports_listening_ports.${number}.functionalities.${number}.action
'. were the const methods = useForm({resolver: yupResolver(Validation(t)),
mode: "onBlur",
});
Beta Was this translation helpful? Give feedback.
All reactions