diff --git a/src/magick-image.ts b/src/magick-image.ts index ce264289..c1aebd58 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 0ca4967b..0162f4c0 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 741b5e60..c9b1c528 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); } }