From 2555d82d390c33b330de9d8128b73935b76f9365 Mon Sep 17 00:00:00 2001 From: Daniel Sil Date: Thu, 4 Apr 2024 15:50:29 +0200 Subject: [PATCH] chore: fix improve types for getBreakpointWidth util function --- .../src/utils/mediaQuery/index.ts | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/packages/orbit-components/src/utils/mediaQuery/index.ts b/packages/orbit-components/src/utils/mediaQuery/index.ts index 684cfce939..f08da67e59 100644 --- a/packages/orbit-components/src/utils/mediaQuery/index.ts +++ b/packages/orbit-components/src/utils/mediaQuery/index.ts @@ -24,16 +24,9 @@ export const TOKEN = { largeDesktop: "widthBreakpointLargeDesktop", } as const; -export interface GetBreakpointWidth { - (name: keyof typeof TOKEN, theme: Theme): string; - (name: keyof typeof TOKEN, theme: Theme, pure: false): string; - (name: keyof typeof TOKEN, theme: Theme, pure: true): number; -} - -export const getBreakpointWidth: GetBreakpointWidth = ( - name: string, - theme: Theme, - pure?: boolean, -) => { +export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme): string; +export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme, pure: false): string; +export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme, pure: true): number; +export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme, pure?: boolean) { return pure ? theme.orbit[TOKEN[name]] : `(min-width: ${theme.orbit[TOKEN[name]]}px)`; -}; +}