Skip to content

Commit

Permalink
Move tailwind types to separate definition
Browse files Browse the repository at this point in the history
  • Loading branch information
miklschmidt committed Dec 17, 2024
1 parent cdbd6ec commit 1106cbb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/helpers.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
type Unpacked<T> = T extends Array<infer U> ? U : T extends ReadonlyArray<infer U> ? U : T;

// eslint-disable-next-line camelcase
declare const __nominal__type: unique symbol;
type Nominal<Type, Identifier> = Type & {
// eslint-disable-next-line camelcase
readonly [__nominal__type]: Identifier;
};

Expand Down Expand Up @@ -63,22 +65,3 @@ type GitVersion = `${number}.${number}.${number}${`-${number}` | ``}${`-${string
type GCode = Nominal<string, 'G-Code'>;

type ReactCallback<T extends Function> = ReturnType<typeof React.useCallback<T>>;

declare module 'tailwindcss/lib/util/flattenColorPalette' {
export default function flattenColorPalette(
colors: Record<string, string | Record<string, string>>,
): Record<string, string>;
}

declare module 'tailwindcss/lib/util/color' {
export const parseColor: (color: string) => {
mode: 'hsl' | 'rgb' | 'hsla' | 'rgba';
color: [number, number, number];
alpha?: string;
};
export const formatColor: (color: {
mode: 'hsl' | 'rgb' | 'hsla' | 'rgba';
color: [number, number, number];
alpha?: string;
}) => string;
}
18 changes: 18 additions & 0 deletions src/lib-tailwind.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
declare module 'tailwindcss/lib/util/flattenColorPalette' {
export default function flattenColorPalette(
colors: Record<string, string | Record<string, string>>,
): Record<string, string>;
}

declare module 'tailwindcss/lib/util/color' {
export const parseColor: (color: string) => {
mode: 'hsl' | 'rgb' | 'hsla' | 'rgba';
color: [number, number, number];
alpha?: string;
};
export const formatColor: (color: {
mode: 'hsl' | 'rgb' | 'hsla' | 'rgba';
color: [number, number, number];
alpha?: string;
}) => string;
}

0 comments on commit 1106cbb

Please sign in to comment.