From fa85133e7b97a7b0a9039a7992dfe54cb7380f54 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Fri, 18 Feb 2022 10:01:34 +0100 Subject: [PATCH] Allow for `BoxVariant` to be `undefined` --- packages/style-engine/src/types.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/style-engine/src/types.ts b/packages/style-engine/src/types.ts index 5f50c0830ad245..48bd9a0d8e5c6e 100644 --- a/packages/style-engine/src/types.ts +++ b/packages/style-engine/src/types.ts @@ -3,12 +3,12 @@ */ import type { CSSProperties } from 'react'; -type BoxVariants = 'margin' | 'padding'; -export type Box< T extends BoxVariants = 'margin' > = { - top?: CSSProperties[ `${ T }Top` ]; - right?: CSSProperties[ `${ T }Right` ]; - bottom?: CSSProperties[ `${ T }Bottom` ]; - left?: CSSProperties[ `${ T }Left` ]; +type BoxVariants = 'margin' | 'padding' | undefined; +export type Box< T extends BoxVariants = undefined > = { + top?: CSSProperties[ T extends undefined ? 'top' : `${ T }Top` ]; + right?: CSSProperties[ T extends undefined ? 'right' : `${ T }Right` ]; + bottom?: CSSProperties[ T extends undefined ? 'bottom' : `${ T }Bottom` ]; + left?: CSSProperties[ T extends undefined ? 'left' : `${ T }Left` ]; }; export interface Style {