aboutsummaryrefslogtreecommitdiff
path: root/src/modules/helpers
diff options
context:
space:
mode:
authorShinigami <[email protected]>2023-02-15 19:29:44 +0100
committerGitHub <[email protected]>2023-02-15 18:29:44 +0000
commite7230f6f10af9633cf0eca18910cbafaaba9ecba (patch)
tree60c27d30661f85b8ec2155e8a2f39ffdb8559f63 /src/modules/helpers
parent1399375686afb99a4ea55a6153601905f395304d (diff)
downloadfaker-e7230f6f10af9633cf0eca18910cbafaaba9ecba.tar.xz
faker-e7230f6f10af9633cf0eca18910cbafaaba9ecba.zip
chore: activate noImplicitAny (#1839)
Diffstat (limited to 'src/modules/helpers')
-rw-r--r--src/modules/helpers/index.ts18
-rw-r--r--src/modules/helpers/unique.ts8
2 files changed, 21 insertions, 5 deletions
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index c22a3612..55732f4a 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -10,7 +10,9 @@ import * as uniqueExec from './unique';
export class HelpersModule {
constructor(private readonly faker: Faker) {
// Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(HelpersModule.prototype)) {
+ for (const name of Object.getOwnPropertyNames(
+ HelpersModule.prototype
+ ) as Array<keyof HelpersModule | 'constructor'>) {
if (name === 'constructor' || typeof this[name] !== 'function') {
continue;
}
@@ -804,8 +806,10 @@ export class HelpersModule {
// Search for the requested method or definition
for (const part of parts) {
- currentModuleOrMethod = currentModuleOrMethod?.[part];
- currentDefinitions = currentDefinitions?.[part];
+ currentModuleOrMethod =
+ currentModuleOrMethod?.[part as keyof typeof currentModuleOrMethod];
+ currentDefinitions =
+ currentDefinitions?.[part as keyof typeof currentDefinitions];
}
// Make method executable
@@ -903,7 +907,13 @@ export class HelpersModule {
*
* @since 7.5.0
*/
- unique<Method extends (...parameters) => RecordKey>(
+ unique<
+ Method extends (
+ // TODO christopher 2023-02-14: This `any` type can be fixed by anyone if they want to.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ...parameters: any[]
+ ) => RecordKey
+ >(
method: Method,
args?: Parameters<Method>,
options: {
diff --git a/src/modules/helpers/unique.ts b/src/modules/helpers/unique.ts
index fd240c2f..ebd1b88e 100644
--- a/src/modules/helpers/unique.ts
+++ b/src/modules/helpers/unique.ts
@@ -81,7 +81,13 @@ Try adjusting maxTime or maxRetries parameters for faker.helpers.unique().`
* @param options.compare The function used to determine whether a value was already returned. Defaults to check the existence of the key.
* @param options.store The store of unique entries. Defaults to `GLOBAL_UNIQUE_STORE`.
*/
-export function exec<Method extends (...parameters) => RecordKey>(
+export function exec<
+ Method extends (
+ // TODO christopher 2023-02-14: This `any` type can be fixed by anyone if they want to.
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ ...parameters: any[]
+ ) => RecordKey
+>(
method: Method,
args: Parameters<Method>,
options: {