From 08997338f69726056b5a9042d24a608ecc544ee7 Mon Sep 17 00:00:00 2001 From: ppillot Date: Thu, 23 Nov 2023 23:00:11 -0500 Subject: [PATCH] Colormaker is a class: it can't be called without new Previous implementation of Colormaker was probably relying on JS prototypal inheritance. Colormaker cannot be called like a function anymore. --- src/color/colormaker-registry.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/color/colormaker-registry.ts b/src/color/colormaker-registry.ts index f5314d4b..6fcfa34e 100644 --- a/src/color/colormaker-registry.ts +++ b/src/color/colormaker-registry.ts @@ -201,15 +201,13 @@ class ColormakerRegistry { delete this.userSchemes[ id ] } - _createScheme (constructor: any) { - const _Colormaker = function (this: any, params: ColormakerParameters) { - Colormaker.call(this, params) - constructor.call(this, params) + _createScheme (constructor: any): typeof Colormaker { + class _Colormaker extends Colormaker { + constructor (params: ColormakerParameters) { + super(params) + constructor.call(this, params) + } } - - _Colormaker.prototype = Colormaker.prototype - _Colormaker.prototype.constructor = Colormaker - return _Colormaker }