summaryrefslogtreecommitdiff
path: root/fs/utils.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2019-05-30 14:59:30 +0200
committerRyan Dahl <ry@tinyclouds.org>2019-05-30 08:59:30 -0400
commit50a79584cb12129b3db1ef3e0eb9d0c8b9f20b62 (patch)
treeee9a90a8b8018c03b1e1a6ace07abdaa494ea90d /fs/utils.ts
parent80b3c486f6222f65b52eb2eca903b67312e8ce0c (diff)
chore: Implement strict mode (denoland/deno_std#453)
Original: https://github.com/denoland/deno_std/commit/be24677d15494e83eea2e99bfc5ccfdde31cb892
Diffstat (limited to 'fs/utils.ts')
-rw-r--r--fs/utils.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/utils.ts b/fs/utils.ts
index 83390ad70..ab5bf2f0e 100644
--- a/fs/utils.ts
+++ b/fs/utils.ts
@@ -16,10 +16,14 @@ export function isSubdir(
}
const srcArray = src.split(sep);
const destArray = dest.split(sep);
-
- return srcArray.reduce((acc, current, i): boolean => {
- return acc && destArray[i] === current;
- }, true);
+ // see: https://github.com/Microsoft/TypeScript/issues/30821
+ return srcArray.reduce(
+ // @ts-ignore
+ (acc: true, current: string, i: number): boolean => {
+ return acc && destArray[i] === current;
+ },
+ true
+ );
}
export type PathType = "file" | "dir" | "symlink";
@@ -29,7 +33,7 @@ export type PathType = "file" | "dir" | "symlink";
*
* @param fileInfo A FileInfo describes a file and is returned by `stat`, `lstat`
*/
-export function getFileInfoType(fileInfo: Deno.FileInfo): PathType {
+export function getFileInfoType(fileInfo: Deno.FileInfo): PathType | undefined {
return fileInfo.isFile()
? "file"
: fileInfo.isDirectory()