Skip to content

Instantly share code, notes, and snippets.

@turbod
Created February 11, 2024 10:17
Show Gist options
  • Save turbod/3976402c1a39f17074ae7a4a74a22ae9 to your computer and use it in GitHub Desktop.
Save turbod/3976402c1a39f17074ae7a4a74a22ae9 to your computer and use it in GitHub Desktop.
type GapType = 'margin' | 'padding';
type PositionType = 'top' | 'right' | 'bottom' | 'left';
type GapCss = `${GapType}-${PositionType}`;
// GapCss: "margin-top" | "margin-right" | "margin-bottom" | "margin-left" | "padding-top" | "padding-right" | "padding-bottom" | "padding-left"
//
type SizeType = 'rem' | 'em' | 'px' | '%' | 'vh' | 'vw' | '';
type SizeCss = `${number}${SizeType}`;
type CssObj = {
[Key in GapCss]?: SizeCss;
}
const cssObj: CssObj = {
'margin-left': '10px'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment