diff --git a/bytes/last_index_of_needle.ts b/bytes/last_index_of_needle.ts index d4f3c00ae4ad..952670802340 100644 --- a/bytes/last_index_of_needle.ts +++ b/bytes/last_index_of_needle.ts @@ -20,7 +20,7 @@ export function lastIndexOfNeedle( source: Uint8Array, needle: Uint8Array, - start = source.length - 1, + start: number = source.length - 1, ): number { if (start < 0) { return -1; diff --git a/http/unstable_cookie_map.ts b/http/unstable_cookie_map.ts index baef5f0a26e9..63341c36115e 100644 --- a/http/unstable_cookie_map.ts +++ b/http/unstable_cookie_map.ts @@ -370,7 +370,7 @@ const keys = Symbol("#keys"); const requestHeaders = Symbol("#requestHeaders"); const responseHeaders = Symbol("#responseHeaders"); const isSecure = Symbol("#secure"); -const requestKeys = Symbol("#requestKeys"); +const requestKeys: unique symbol = Symbol("#requestKeys"); /** An internal abstract class which provides common functionality for * {@link CookieMap} and {@link SecureCookieMap}. @@ -417,7 +417,7 @@ abstract class CookieMapBase implements Mergeable { return init; } - [Symbol.for("Deno.customInspect")]() { + [Symbol.for("Deno.customInspect")](): string { return `${this.constructor.name} []`; } @@ -426,7 +426,7 @@ abstract class CookieMapBase implements Mergeable { // deno-lint-ignore no-explicit-any options: any, inspect: (value: unknown, options?: unknown) => string, - ) { + ): string { if (depth < 0) { return options.stylize(`[${this.constructor.name}]`, "special"); } diff --git a/io/slice_long_to_bytes.ts b/io/slice_long_to_bytes.ts index a832d3cbed91..61dfbd41a59b 100644 --- a/io/slice_long_to_bytes.ts +++ b/io/slice_long_to_bytes.ts @@ -10,7 +10,7 @@ */ export function sliceLongToBytes( d: number, - dest = Array.from({ length: 8 }), + dest: number[] = Array.from({ length: 8 }), ): number[] { let big = BigInt(d); for (let i = 0; i < 8; i++) { diff --git a/log/handlers.ts b/log/handlers.ts index ef04989ca4fe..7837a0919415 100644 --- a/log/handlers.ts +++ b/log/handlers.ts @@ -143,7 +143,7 @@ export class FileHandler extends WriterHandler { protected _filename: string; protected _mode: LogMode; protected _openOptions: Deno.OpenOptions; - protected _encoder = new TextEncoder(); + protected _encoder: TextEncoder = new TextEncoder(); #unloadCallback = (() => { this.destroy(); }).bind(this); diff --git a/log/mod.ts b/log/mod.ts index d5ebb38d0849..3bafde5cedfe 100644 --- a/log/mod.ts +++ b/log/mod.ts @@ -357,7 +357,7 @@ */ import { Logger } from "./logger.ts"; -import type { GenericFunction } from "./logger.ts"; +import type { GenericFunction, LogRecord } from "./logger.ts"; import { BaseHandler, ConsoleHandler, @@ -439,7 +439,9 @@ export const handlers = { RotatingFileHandler, }; -export const formatters = { +export const formatters: { + jsonFormatter(logRecord: LogRecord): string; +} = { jsonFormatter, }; diff --git a/path/common.ts b/path/common.ts index 5ac90e93c396..449ebaf309fc 100644 --- a/path/common.ts +++ b/path/common.ts @@ -16,6 +16,6 @@ import { SEP } from "./separator.ts"; * console.log(p); // "./deno/std/" * ``` */ -export function common(paths: string[], sep = SEP): string { +export function common(paths: string[], sep: typeof SEP = SEP): string { return _common(paths, sep); } diff --git a/path/posix/common.ts b/path/posix/common.ts index ae1bc581e562..5acbbd70658d 100644 --- a/path/posix/common.ts +++ b/path/posix/common.ts @@ -16,6 +16,6 @@ import { SEP } from "./separator.ts"; * console.log(p); // "./deno/std/" * ``` */ -export function common(paths: string[], sep = SEP): string { +export function common(paths: string[], sep: typeof SEP = SEP): string { return _common(paths, sep); } diff --git a/path/windows/common.ts b/path/windows/common.ts index ae1bc581e562..5acbbd70658d 100644 --- a/path/windows/common.ts +++ b/path/windows/common.ts @@ -16,6 +16,6 @@ import { SEP } from "./separator.ts"; * console.log(p); // "./deno/std/" * ``` */ -export function common(paths: string[], sep = SEP): string { +export function common(paths: string[], sep: typeof SEP = SEP): string { return _common(paths, sep); } diff --git a/streams/byte_slice_stream.ts b/streams/byte_slice_stream.ts index 994d580d0647..4e7e7a4180c5 100644 --- a/streams/byte_slice_stream.ts +++ b/streams/byte_slice_stream.ts @@ -21,7 +21,7 @@ export class ByteSliceStream extends TransformStream { #offsetEnd = 0; /** Constructs a new instance. */ - constructor(start = 0, end = Infinity) { + constructor(start = 0, end: number = Infinity) { super({ start: () => { assert(start >= 0, "`start` must be greater than 0"); diff --git a/yaml/schema/core.ts b/yaml/schema/core.ts index c8674e6292e6..59e8e9d40c8e 100644 --- a/yaml/schema/core.ts +++ b/yaml/schema/core.ts @@ -9,6 +9,6 @@ import { json } from "./json.ts"; // Standard YAML's Core schema. // http://www.yaml.org/spec/1.2/spec.html#id2804923 -export const core = new Schema({ +export const core: Schema = new Schema({ include: [json], }); diff --git a/yaml/schema/default.ts b/yaml/schema/default.ts index 32e9741f0694..909173bb514f 100644 --- a/yaml/schema/default.ts +++ b/yaml/schema/default.ts @@ -10,7 +10,7 @@ import { core } from "./core.ts"; // JS-YAML's default schema for `safeLoad` function. // It is not described in the YAML specification. -export const def = new Schema({ +export const def: Schema = new Schema({ explicit: [binary, omap, pairs, set], implicit: [timestamp, merge], include: [core], diff --git a/yaml/schema/extended.ts b/yaml/schema/extended.ts index 5526c6119489..83452269edae 100644 --- a/yaml/schema/extended.ts +++ b/yaml/schema/extended.ts @@ -33,7 +33,7 @@ import { def } from "./default.ts"; * ); * ``` */ -export const extended = new Schema({ +export const extended: Schema = new Schema({ explicit: [regexp, undefinedType], include: [def], }); diff --git a/yaml/schema/failsafe.ts b/yaml/schema/failsafe.ts index 62c310a69923..bcfa5a4ea210 100644 --- a/yaml/schema/failsafe.ts +++ b/yaml/schema/failsafe.ts @@ -9,6 +9,6 @@ import { map, seq, str } from "../_type/mod.ts"; // Standard YAML's Failsafe schema. // http://www.yaml.org/spec/1.2/spec.html#id2802346 -export const failsafe = new Schema({ +export const failsafe: Schema = new Schema({ explicit: [str, seq, map], }); diff --git a/yaml/schema/json.ts b/yaml/schema/json.ts index 73df97c91186..68a147c9984f 100644 --- a/yaml/schema/json.ts +++ b/yaml/schema/json.ts @@ -10,7 +10,7 @@ import { failsafe } from "./failsafe.ts"; // Standard YAML's JSON schema. // http://www.yaml.org/spec/1.2/spec.html#id2803231 -export const json = new Schema({ +export const json: Schema = new Schema({ implicit: [nil, bool, int, float], include: [failsafe], });