Skip to content

Commit

Permalink
refactor(fs): prepare for noUncheckedIndexedAccess (denoland#4277)
Browse files Browse the repository at this point in the history
* refactor: fs-noUncheckedIndexedAccess

* tweak

---------

Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
  • Loading branch information
eryue0220 and iuioiua authored Feb 7, 2024
1 parent 20dae6b commit 52138c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions fs/expand_glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export async function* expandGlob(
let fixedRoot = isGlobAbsolute
? winRoot !== undefined ? winRoot : "/"
: absRoot;
while (segments.length > 0 && !isGlob(segments[0])) {
while (segments.length > 0 && !isGlob(segments[0]!)) {
const seg = segments.shift();
assert(seg !== undefined);
fixedRoot = joinGlobs([fixedRoot, seg], globOptions);
Expand Down Expand Up @@ -253,7 +253,7 @@ export function* expandGlobSync(
let fixedRoot = isGlobAbsolute
? winRoot !== undefined ? winRoot : "/"
: absRoot;
while (segments.length > 0 && !isGlob(segments[0])) {
while (segments.length > 0 && !isGlob(segments[0]!)) {
const seg = segments.shift();
assert(seg !== undefined);
fixedRoot = joinGlobs([fixedRoot, seg], globOptions);
Expand Down
8 changes: 4 additions & 4 deletions fs/move_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ Deno.test("move() accepts overwrite option set to true for file content", async
[file, url],
[url, file],
[url, url],
];
] as const;

for (const p of pairs) {
const src = p[0];
Expand All @@ -415,7 +415,7 @@ Deno.test("move() accepts overwrite option set to true for directories", async f
[dir, url],
[url, dir],
[url, url],
];
] as const;

for (const p of pairs) {
const src = p[0];
Expand Down Expand Up @@ -446,7 +446,7 @@ Deno.test("moveSync() accepts overwrite option set to true for file content", fu
[file, url],
[url, file],
[url, url],
];
] as const;

for (const p of pairs) {
const src = p[0];
Expand All @@ -473,7 +473,7 @@ Deno.test("move() accepts overwrite option set to true for directories", functio
[dir, url],
[url, dir],
[url, url],
];
] as const;

for (const p of pairs) {
const src = p[0];
Expand Down
2 changes: 1 addition & 1 deletion fs/testdata/empty_dir.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { emptyDir } from "../empty_dir.ts";

emptyDir(Deno.args[0])
emptyDir(Deno.args[0]!)
.then(() => {
Deno.stdout.write(new TextEncoder().encode("success"));
})
Expand Down
2 changes: 1 addition & 1 deletion fs/testdata/empty_dir_sync.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { emptyDirSync } from "../empty_dir.ts";

try {
emptyDirSync(Deno.args[0]);
emptyDirSync(Deno.args[0]!);
Deno.stdout.write(new TextEncoder().encode("success"));
} catch (err) {
Deno.stdout.write(
Expand Down

0 comments on commit 52138c6

Please sign in to comment.