Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(fs): prepare for noUncheckedIndexedAccess #4277

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]!)) {
iuioiua marked this conversation as resolved.
Show resolved Hide resolved
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])
iuioiua marked this conversation as resolved.
Show resolved Hide resolved
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]!);
iuioiua marked this conversation as resolved.
Show resolved Hide resolved
Deno.stdout.write(new TextEncoder().encode("success"));
} catch (err) {
Deno.stdout.write(
Expand Down
Loading