From 2f938ead4172fa0f3aa6f2eb32602e9a19f10f69 Mon Sep 17 00:00:00 2001 From: David Goitia Date: Mon, 23 May 2022 17:42:46 +0200 Subject: [PATCH] Missing error collection types --- errors.d.ts | 12 ++++++++++++ regedit.d.ts | 6 +----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 errors.d.ts diff --git a/errors.d.ts b/errors.d.ts new file mode 100644 index 000000000..ae512a53b --- /dev/null +++ b/errors.d.ts @@ -0,0 +1,12 @@ +export interface ErrorWithCode extends Error { + code: number; + description?: string; +} + +type Errors = { + [key: number]: ErrorWithCode; +}; + +const errors: Errors; + +export default errors; diff --git a/regedit.d.ts b/regedit.d.ts index 9100c89b2..18b752182 100644 --- a/regedit.d.ts +++ b/regedit.d.ts @@ -1,4 +1,5 @@ import type { Readable } from 'stream'; +import type { ErrorWithCode } from './errors'; export interface REG_SZ_Value { value: string; @@ -156,11 +157,6 @@ export type FOLDER_FOUND = 'Folder found and set'; export type FOLDER_NOT_FOUND = 'Folder not found'; export function setExternalVBSLocation(newLocation: string): FOLDER_FOUND | FOLDER_NOT_FOUND; -interface ErrorWithCode extends Error { - code: number; - description: string; -} - type ErrCallback = (err: ErrorWithCode | undefined) => void; export function createKey(keys: readonly K[], callback: ErrCallback): void;