tidy(ui): clean up unused code 5

variables, types and schemas
This commit is contained in:
psychedelicious
2024-02-27 18:13:16 +11:00
parent b661d93bd8
commit d99bec8b1a
44 changed files with 151 additions and 996 deletions

View File

@ -11,13 +11,6 @@ export type MetadataRenderValueFunc<T> = (value: T) => Promise<React.ReactNode>;
*/
export type MetadataGetLabelFunc = () => string;
export type MetadataParseOptions = {
toastOnFailure?: boolean;
toastOnSuccess?: boolean;
};
export type MetadataRecallOptions = MetadataParseOptions;
/**
* A function that recalls a parsed and validated metadata value.
*
@ -119,7 +112,7 @@ export type MetadataHandlers<TValue = unknown, TItem = unknown> = {
// type MetadataHandlersInferItem<TValue> = TValue extends Array<infer TItem> ? MetadataParseFunc<TItem> : never
// While this works for the types as expected, I couldn't satisfy TS in the implementations of the handlers.
export type BuildMetadataHandlersArg<TValue, TItem> = {
type BuildMetadataHandlersArg<TValue, TItem> = {
parser: MetadataParseFunc<TValue>;
itemParser?: MetadataParseFunc<TItem>;
recaller?: MetadataRecallFunc<TValue>;

View File

@ -7,7 +7,7 @@ import type { AnyModelConfig, BaseModelType, ModelType } from 'services/api/type
/**
* Raised when a model config is unable to be fetched.
*/
export class ModelConfigNotFoundError extends Error {
class ModelConfigNotFoundError extends Error {
/**
* Create ModelConfigNotFoundError
* @param {String} message
@ -58,11 +58,7 @@ export const fetchModelConfig = async (key: string): Promise<AnyModelConfig> =>
* @returns A promise that resolves to the model config.
* @throws {ModelConfigNotFoundError} If the model config is unable to be fetched.
*/
export const fetchModelConfigByAttrs = async (
name: string,
base: BaseModelType,
type: ModelType
): Promise<AnyModelConfig> => {
const fetchModelConfigByAttrs = async (name: string, base: BaseModelType, type: ModelType): Promise<AnyModelConfig> => {
const { dispatch } = getStore();
try {
const req = dispatch(modelsApi.endpoints.getModelConfigByAttrs.initiate({ name, base, type }));

View File

@ -78,7 +78,7 @@ export const MetadataParseFailedToken = Symbol('failed');
/**
* Raised when metadata parsing fails.
*/
export class MetadataParseError extends Error {
class MetadataParseError extends Error {
/**
* Create MetadataParseError
* @param {String} message