From 5ff1b029c4dd6c0e5ff3063958ffb1c36baa12c8 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 22 Dec 2023 00:21:45 -0500 Subject: [PATCH] chore: more explicit types --- src/command.ts | 4 ++-- src/path.ts | 4 ++-- src/pipes.ts | 4 ++-- src/request.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/command.ts b/src/command.ts index 981b17e..248aaeb 100644 --- a/src/command.ts +++ b/src/command.ts @@ -71,7 +71,7 @@ const builtInCommands = { }; /** @internal */ -export const getRegisteredCommandNamesSymbol = Symbol(); +export const getRegisteredCommandNamesSymbol: unique symbol = Symbol(); /** * Underlying builder API for executing commands. @@ -483,7 +483,7 @@ export class CommandBuilder implements PromiseLike { } /** @internal */ - [getRegisteredCommandNamesSymbol]() { + [getRegisteredCommandNamesSymbol](): string[] { return Object.keys(this.#state.commands); } } diff --git a/src/path.ts b/src/path.ts index 71fe8fd..fda3749 100644 --- a/src/path.ts +++ b/src/path.ts @@ -84,13 +84,13 @@ export class PathRef { } /** @internal */ - static [Symbol.hasInstance](instance: any) { + static [Symbol.hasInstance](instance: any): boolean { // this should never change because it should work accross versions return instance?.constructor?.instanceofSymbol === PathRef.instanceofSymbol; } /** @internal */ - [Symbol.for("Deno.customInspect")]() { + [Symbol.for("Deno.customInspect")](): string { return `PathRef("${this.#path}")`; } diff --git a/src/pipes.ts b/src/pipes.ts index 8b011fb..b93214a 100644 --- a/src/pipes.ts +++ b/src/pipes.ts @@ -123,7 +123,7 @@ export class PipedBuffer implements WriterSync { this.#inner = new Buffer(); } - getBuffer() { + getBuffer(): Buffer | undefined { if (this.#inner instanceof Buffer) { return this.#inner; } else { @@ -143,7 +143,7 @@ export class PipedBuffer implements WriterSync { } } - writeSync(p: Uint8Array) { + writeSync(p: Uint8Array): number { return this.#inner.writeSync(p); } diff --git a/src/request.ts b/src/request.ts index 1ca7258..d83ffd4 100644 --- a/src/request.ts +++ b/src/request.ts @@ -21,7 +21,7 @@ interface RequestBuilderState { } /** @internal */ -export const withProgressBarFactorySymbol = Symbol(); +export const withProgressBarFactorySymbol: unique symbol = Symbol(); /** * Builder API for downloading files. @@ -197,7 +197,7 @@ export class RequestBuilder implements PromiseLike { } /** @internal */ - [withProgressBarFactorySymbol](factory: (message: string) => ProgressBar) { + [withProgressBarFactorySymbol](factory: (message: string) => ProgressBar): RequestBuilder { return this.#newWithState((state) => { state.progressBarFactory = factory; });