Skip to content

Commit

Permalink
[types] Add missing string option type in toGamut
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmeister committed Sep 18, 2023
1 parent f225561 commit 8eeae72
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/toGamut.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import getColor from "./getColor.js";
/**
* Force coordinates to be in gamut of a certain color space.
* Mutates the color it is passed.
* @param {Object} options
* @param {Object|string} options object or spaceId string
* @param {string} options.method - How to force into gamut.
* If "clip", coordinates are just clipped to their reference range.
* If in the form [colorSpaceId].[coordName], that coordinate is reduced
Expand Down
2 changes: 1 addition & 1 deletion types/src/toGamut.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare function toGamut(
options?: {
method?: string | undefined;
space?: string | ColorSpace | undefined;
}
} | string
): PlainColorObject;

export default toGamut;
1 change: 1 addition & 0 deletions types/test/toGamut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ toGamut("red"); // $ExpectType PlainColorObject
toGamut(new Color("red")); // $ExpectType PlainColorObject
toGamut(new Color("red"), { method: "clip", space: "srgb" }); // $ExpectType PlainColorObject
toGamut(new Color("red"), { method: "clip", space: sRGB }); // $ExpectType PlainColorObject
toGamut(new Color("red"), "srgb"); // $ExpectType PlainColorObject

0 comments on commit 8eeae72

Please sign in to comment.