Skip to content

Commit

Permalink
Silence warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Dec 4, 2024
1 parent abfa06f commit ea3c287
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/magick-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/profiles/color/color-profile/constructor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
});

Expand Down
2 changes: 1 addition & 1 deletion tests/test-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit ea3c287

Please sign in to comment.