From 5f947cbd4773f768a90243e54fd707c9769e8530 Mon Sep 17 00:00:00 2001 From: Shinigami Date: Tue, 18 Jul 2023 07:23:26 +0200 Subject: chore: enable strictBindCallApply (#2254) --- src/modules/image/index.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/modules/image') diff --git a/src/modules/image/index.ts b/src/modules/image/index.ts index a44c2efb..cfefdb8a 100644 --- a/src/modules/image/index.ts +++ b/src/modules/image/index.ts @@ -1,4 +1,5 @@ import type { Faker } from '../..'; +import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions'; import { deprecated } from '../../internal/deprecated'; import type { MethodsOf } from '../../utils/types'; import { LoremPicsum } from './providers/lorempicsum'; @@ -38,18 +39,7 @@ export class ImageModule { readonly placeholder: Placeholder; constructor(private readonly faker: Faker) { - // Bind `this` so namespaced is working correctly - for (const name of Object.getOwnPropertyNames( - ImageModule.prototype - ) as Array) { - if (name === 'constructor' || typeof this[name] !== 'function') { - continue; - } - - this[name] = - // @ts-expect-error: remove this expect-error when we remove the deprecated sub-modules - this[name].bind(this); - } + bindThisToMemberFunctions(this); // eslint-disable-next-line deprecation/deprecation this.unsplash = new Unsplash(this.faker); -- cgit v1.2.3