diff --git a/core/types/index.d.ts b/core/types/index.d.ts index 03b56071f..5e289b749 100644 --- a/core/types/index.d.ts +++ b/core/types/index.d.ts @@ -496,8 +496,21 @@ declare module '@verdaccio/types' { tag?: string; } - type AuthAccessCallback = (error: string | null, access: boolean) => void; - type AuthCallback = (error: string | null, groups: string[] | false) => void; + // FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` instead of AuthError + // but this type is on @verdaccio/commons-api and cannot be used here yet (I don't know why) + interface HttpError extends Error { + status: number; + statusCode: number; + expose: boolean; + headers?: { + [key: string]: string; + }; + [key: string]: any; + } + + type AuthError = HttpError & { code: number }; + type AuthAccessCallback = (error: AuthError | null, access: boolean) => void; + type AuthCallback = (error: AuthError | null, groups: string[] | false) => void; interface IPluginAuth extends IPlugin { authenticate(user: string, password: string, cb: AuthCallback): void;