diff options
| author | eric sciple <ericsciple@users.noreply.github.com> | 2021-10-19 09:52:57 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-19 09:52:57 -0500 |
| commit | 5ee37f14842852931cb987e86d63ffb679abd036 (patch) | |
| tree | 62fac9cbba0ad2cb177776904836eb5b2e88076c /src/fs-helper.ts | |
| parent | 6a88a892fe72e01ab1409fe94c4d26e71b939c94 (diff) | |
update dev dependencies and react to new linting rules (#611)
Diffstat (limited to 'src/fs-helper.ts')
| -rw-r--r-- | src/fs-helper.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/fs-helper.ts b/src/fs-helper.ts index c443404..3741d35 100644 --- a/src/fs-helper.ts +++ b/src/fs-helper.ts @@ -9,7 +9,7 @@ export function directoryExistsSync(path: string, required?: boolean): boolean { try { stats = fs.statSync(path) } catch (error) { - if (error.code === 'ENOENT') { + if ((error as any)?.code === 'ENOENT') { if (!required) { return false } @@ -18,7 +18,8 @@ export function directoryExistsSync(path: string, required?: boolean): boolean { } throw new Error( - `Encountered an error when checking whether path '${path}' exists: ${error.message}` + `Encountered an error when checking whether path '${path}' exists: ${(error as any) + ?.message ?? error}` ) } @@ -39,12 +40,13 @@ export function existsSync(path: string): boolean { try { fs.statSync(path) } catch (error) { - if (error.code === 'ENOENT') { + if ((error as any)?.code === 'ENOENT') { return false } throw new Error( - `Encountered an error when checking whether path '${path}' exists: ${error.message}` + `Encountered an error when checking whether path '${path}' exists: ${(error as any) + ?.message ?? error}` ) } @@ -60,12 +62,13 @@ export function fileExistsSync(path: string): boolean { try { stats = fs.statSync(path) } catch (error) { - if (error.code === 'ENOENT') { + if ((error as any)?.code === 'ENOENT') { return false } throw new Error( - `Encountered an error when checking whether path '${path}' exists: ${error.message}` + `Encountered an error when checking whether path '${path}' exists: ${(error as any) + ?.message ?? error}` ) } |
