From 85782637afe2a84a893985646f305beacec39d0d Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 15 Jul 2024 20:57:24 -0700 Subject: [PATCH] Slight code tweak --- src/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index b6adbd7..8d2ee71 100644 --- a/src/index.ts +++ b/src/index.ts @@ -40,7 +40,7 @@ export class Task { private _!: never; /* @internal */ - options: TaskOptions; + readonly options: TaskOptions; /* @internal */ static create(options: TaskOptions): Task { @@ -66,11 +66,9 @@ export class Task { if (!Array.isArray(options.dependencies) && options.dependencies !== undefined) { throw new TypeError("Task dependencies is not an array or undefined."); } - if (options.dependencies) { - for (const dep of options.dependencies) { - if (!(dep instanceof Task)) { - throw new TypeError("Task dependency is not a task."); - } + for (const dep of options.dependencies ?? []) { + if (!(dep instanceof Task)) { + throw new TypeError("Task dependency is not a task."); } }