chore: fix types for compile issue
This commit is contained in:
@@ -87,7 +87,8 @@ export const useEnvironment = create<EnvStore>((set, get) => ({
|
||||
const rawVars = compileEnvVars();
|
||||
const safeVars = EnvSchema.parse(rawVars);
|
||||
set({ ...safeVars });
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
set({
|
||||
status: 'failed',
|
||||
error: t('Error processing the Vega environemnt'),
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
import type { ZodIssue, ZodError } from 'zod';
|
||||
import type { ZodIssue } from 'zod';
|
||||
import { ZodError } from 'zod';
|
||||
|
||||
export const compileErrors = (headline: string, error: ZodError) => {
|
||||
return error.issues.reduce((acc, issue) => {
|
||||
return acc + `\n - ${compileIssue(issue)}`;
|
||||
}, headline);
|
||||
export const compileErrors = (
|
||||
headline: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
error: any
|
||||
) => {
|
||||
if (error instanceof ZodError) {
|
||||
return error.issues.reduce((acc, issue) => {
|
||||
return acc + `\n - ${compileIssue(issue)}`;
|
||||
}, headline);
|
||||
}
|
||||
|
||||
return `${headline}${error?.message ? `: ${error.message}` : ''}`;
|
||||
};
|
||||
|
||||
const compileIssue = (issue: ZodIssue) => {
|
||||
|
||||
@@ -89,10 +89,6 @@ export const validateEnvironment = (
|
||||
return undefined;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
return compileErrors(
|
||||
'Error processing the vega app environment',
|
||||
err,
|
||||
compileIssue
|
||||
);
|
||||
return compileErrors('Error processing the vega app environment', err);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user