Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type def for MixOptions #347

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions types/src/interpolation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ export function range(
options?: RangeOptions & Record<string, any>
): Range;

export interface MixOptions {
space?: string | ColorSpace | undefined;
outputSpace?: string | ColorSpace | undefined;
premultiplied?: boolean | undefined;
}
// tslint:disable-next-line:no-empty-interface
export interface MixOptions extends RangeOptions {}

export function mix(
color1: ColorTypes,
Expand Down
5 changes: 3 additions & 2 deletions types/test/interpolation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ mix("red", "blue", {}); // $ExpectType PlainColorObject
mix("red", "blue", 0.5, {}); // $ExpectType PlainColorObject
// $ExpectType PlainColorObject
mix("red", "blue", {
space: "srgb",
space: "hsl",
outputSpace: "srgb_linear",
premultiplied: true,
hue: "shorter",
});

// Test mix on Color class
Expand All @@ -55,7 +56,7 @@ Color.mix("red", "blue", 123, { space: "srgb" }); // $ExpectType Color
new Color("red").mix("blue"); // $ExpectType Color
new Color("red").mix("blue", 123); // $ExpectType Color
new Color("red").mix("blue", { space: "srgb" }); // $ExpectType Color
new Color("red").mix("blue", 123, { space: "srgb" }); // $ExpectType Color
new Color("red").mix("blue", 123, { space: "hsl", hue: "shorter" }); // $ExpectType Color

steps("red", "blue"); // $ExpectType PlainColorObject[]
// $ExpectType PlainColorObject[]
Expand Down