refactor: put types in utils

This commit is contained in:
Pihkaal
2024-05-30 16:01:17 +02:00
parent b5dfdc1f84
commit ca5c504d2c
4 changed files with 17 additions and 9 deletions

View File

@@ -5,7 +5,7 @@ import {
useRef,
useState,
} from "react";
import { type InnerKittyProps } from "../../context/KittyContext";
import { type InnerKittyProps } from "~/utils/types";
import { CHAR_WIDTH } from "../Kitty";
import { useKitty } from "~/hooks/useKitty";

View File

@@ -2,7 +2,7 @@ import { useState } from "react";
import { formatMMSS } from "../../utils/time";
import { CharArray } from "../../utils/string";
import { CHAR_HEIGHT, CHAR_WIDTH } from "../Kitty";
import { type InnerKittyProps } from "../../context/KittyContext";
import { type InnerKittyProps } from "~/utils/types";
import { useKitty } from "~/hooks/useKitty";
export const SpotifyPlayer = (props: {

View File

@@ -9,10 +9,3 @@ export type KittyContextProps = {
cols: number;
active: boolean;
};
type Prettify<T> = NonNullable<{ [K in keyof T]: T[K] }>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type InnerKittyProps<T extends (...args: any[]) => any> = Prettify<
Parameters<T>[0] & KittyContextProps
>;

15
src/utils/types.ts Normal file
View File

@@ -0,0 +1,15 @@
import { KittyContextProps } from "~/context/KittyContext";
export type Prettify<T> = NonNullable<{ [K in keyof T]: T[K] }>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type InnerKittyProps<T extends (...args: any[]) => any> = Prettify<
Parameters<T>[0] & KittyContextProps
>;
export type Manifest = {
projects: Array<{
name: string;
files: Array<string>;
}>;
};