From ea3c287dbf624bcb388c13c8b894e6b2f77f59be Mon Sep 17 00:00:00 2001 From: Dirk Lemstra <dirk@lemstra.org> Date: Wed, 4 Dec 2024 17:34:59 +0100 Subject: [PATCH] Silence warnings. --- src/magick-image.ts | 2 +- tests/profiles/color/color-profile/constructor.spec.ts | 4 +++- tests/test-files.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/magick-image.ts b/src/magick-image.ts index ce26428..c1aebd5 100644 --- a/src/magick-image.ts +++ b/src/magick-image.ts @@ -2827,7 +2827,7 @@ export class MagickImage extends NativeInstance implements IMagickImage { for (const name of names) { const data = this._getProfile(name); if (data !== null) { - return new ColorProfile(name, data); + return new ColorProfile(<'icc' | 'icm'>name, data); } } diff --git a/tests/profiles/color/color-profile/constructor.spec.ts b/tests/profiles/color/color-profile/constructor.spec.ts index 0ca4967..0162f4c 100644 --- a/tests/profiles/color/color-profile/constructor.spec.ts +++ b/tests/profiles/color/color-profile/constructor.spec.ts @@ -8,13 +8,15 @@ import { ColorProfile } from '@src/profiles/color/color-profile'; describe('ColorProfile#constructor', () => { it('should allow icm and icc as the name', () => { let colorProfile = new ColorProfile('icm', new Uint8Array(0)); + expect(colorProfile.name).toBe('icm'); + colorProfile = new ColorProfile('icc', new Uint8Array(0)); expect(colorProfile.name).toBe('icc'); }); it('should not allow invalid color profile names', () => { expect(() => { - new ColorProfile('foo', new Uint8Array(0)); + new ColorProfile(<'icc' | 'icm'>'foo', new Uint8Array(0)); }).toThrowError('Invalid profile name: foo.'); }); diff --git a/tests/test-files.ts b/tests/test-files.ts index 741b5e6..c9b1c52 100644 --- a/tests/test-files.ts +++ b/tests/test-files.ts @@ -123,7 +123,7 @@ export class TestColorProfile extends TestFile { } load(): ColorProfile { - return new ColorProfile(this.name, this.data); + return new ColorProfile(<'icc' | 'icm'>this.name, this.data); } }