diff --git a/packages/ui/.storybook/preview.tsx b/packages/ui/.storybook/preview.tsx index 3aaf9176cf..2532169539 100644 --- a/packages/ui/.storybook/preview.tsx +++ b/packages/ui/.storybook/preview.tsx @@ -38,9 +38,9 @@ initializeMsw({ if (url.startsWith('/trpc' || '/api')) { console.error(`Unhandled ${method} request to ${url}. - This exception has been only logged in the console, however, it's strongly recommended to resolve this error as you don't want unmocked data in Storybook stories. - If you wish to mock an error response, please refer to this guide: https://mswjs.io/docs/recipes/mocking-error-responses - `) + This exception has been only logged in the console, however, it's strongly recommended to resolve this error as you don't want unmocked data in Storybook stories. + If you wish to mock an error response, please refer to this guide: https://mswjs.io/docs/recipes/mocking-error-responses + `) } }, }) @@ -134,14 +134,13 @@ type PseudoStates = | 'link' | 'target' -type DesignParams = { name?: string } & ( - | { - type: 'figma' - url: `https://${string}` - } - | { - type: 'figspec' - url: `https://${string}` - accessToken: string - } -) +type DesignParams = ({ name?: string } & DesignFigma) | DesignFigspec +type DesignFigma = { + type: 'figma' + url: `https://${string}` +} +type DesignFigspec = { + type: 'figspec' + url: `https://${string}` + accessToken: string +} diff --git a/packages/ui/components/core/Badge/index.tsx b/packages/ui/components/core/Badge/index.tsx index a4eba11c81..24134c207a 100644 --- a/packages/ui/components/core/Badge/index.tsx +++ b/packages/ui/components/core/Badge/index.tsx @@ -520,19 +520,20 @@ interface BadgeStylesParams { minify?: boolean hideBg?: boolean } +interface BadgeOtherProps extends Omit { + /** Preset designs */ + variant?: + | Exclude + | 'outline' + /** + * Item rendered on the left side of the badge. Should be either an emoji unicode string or an Icon + * component + */ + leftSection?: ReactNode + hideTooltip?: boolean +} export type CustomBadgeProps = - | (Omit & { - /** Preset designs */ - variant?: - | Exclude - | 'outline' - /** - * Item rendered on the left side of the badge. Should be either an emoji unicode string or an Icon - * component - */ - leftSection?: ReactNode - hideTooltip?: boolean - }) + | BadgeOtherProps | LeaderBadgeProps | VerifiedBadgeProps | AttributeTagProps diff --git a/packages/ui/lib/trpcResponse.ts b/packages/ui/lib/trpcResponse.ts index b03fee1e72..4be780aaa4 100644 --- a/packages/ui/lib/trpcResponse.ts +++ b/packages/ui/lib/trpcResponse.ts @@ -13,20 +13,18 @@ export type RpcSuccessResponse = { data: Data | SuperJSONResult } } - +type ErrorObject = { + message: string + code: number + data: { + code: string + httpStatus: number + stack: string + path: string //TQuery + } +} export type RpcErrorResponse = { - error: - | { - message: string - code: number - data: { - code: string - httpStatus: number - stack: string - path: string //TQuery - } - } - | SuperJSONResult + error: ErrorObject | SuperJSONResult } // According to JSON-RPC 2.0 and tRPC documentation. diff --git a/packages/ui/providers/SearchState.tsx b/packages/ui/providers/SearchState.tsx index 42e3dae1c3..fd25659ca6 100644 --- a/packages/ui/providers/SearchState.tsx +++ b/packages/ui/providers/SearchState.tsx @@ -89,16 +89,15 @@ export const SearchStateProvider = ({ children, initState }: SearchStateProvider ) } +type RouteParams = { + params: string[] + page: string + a?: string[] + s?: string[] + sort?: string[] +} -type GetRoute = () => - | { - params: string[] - page: string - a?: string[] - s?: string[] - sort?: string[] - } - | undefined +type GetRoute = () => RouteParams | undefined export interface SearchStateContext { searchState: State & { attributes: string[]; services: string[]; getRoute: GetRoute }