Skip to content

Commit 1ce7168

Browse files
committed
Fix: Replaced the blanket Function type with AnyFn = (...args: unknown[]) => unknown.
This silences no-unsafe-function-type linting rule and restores minimal type-safety (no implicit any) while leaving runtime behaviour untouched.
1 parent 5c8bd8e commit 1ce7168

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/CreateDestroy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ function ready(
118118
} else if (descriptor.set != null) {
119119
kind = 'set';
120120
}
121-
const f: Function = descriptor[kind];
121+
type AnyFn = (...args: Array<unknown>) => unknown;
122+
const f = descriptor[kind] as AnyFn;
122123
if (typeof f !== 'function') {
123124
throw new TypeError(`${key} is not a function`);
124125
}

src/CreateDestroyStartStop.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ function ready(
238238
} else if (descriptor.set != null) {
239239
kind = 'set';
240240
}
241-
const f: Function = descriptor[kind];
241+
type AnyFn = (...args: Array<unknown>) => unknown;
242+
const f = descriptor[kind] as AnyFn;
242243
if (typeof f !== 'function') {
243244
throw new TypeError(`${key} is not a function`);
244245
}

src/StartStop.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ function ready(
159159
} else if (descriptor.set != null) {
160160
kind = 'set';
161161
}
162-
const f: Function = descriptor[kind];
162+
type AnyFn = (...args: Array<unknown>) => unknown;
163+
const f = descriptor[kind] as AnyFn;
163164
if (typeof f !== 'function') {
164165
throw new TypeError(`${key} is not a function`);
165166
}

src/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ function promise<T = void>(): PromiseDeconstructed<T> {
4242
* This function rewrites the stack trace according to where the wrapped
4343
* function is called, giving a more useful stack trace
4444
*/
45-
function resetStackTrace(error: Error, decorated?: Function): void {
45+
function resetStackTrace(
46+
error: Error,
47+
decorated?: (...args: Array<unknown>) => unknown,
48+
): void {
4649
if (error.stack != null) {
4750
const stackTitle = error.stack.slice(0, error.stack.indexOf('\n') + 1);
4851
if (hasCaptureStackTrace) {

0 commit comments

Comments
 (0)