refactor: put types in utils
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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
15
src/utils/types.ts
Normal 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>;
|
||||
}>;
|
||||
};
|
||||
Reference in New Issue
Block a user