diff --git a/.changeset/afraid-snails-trade.md b/.changeset/afraid-snails-trade.md new file mode 100644 index 0000000000..150da45e75 --- /dev/null +++ b/.changeset/afraid-snails-trade.md @@ -0,0 +1,5 @@ +--- +'@leafygreen-ui/tokens': minor +--- + +Adds `Size` token diff --git a/.changeset/shy-houses-pump.md b/.changeset/shy-houses-pump.md new file mode 100644 index 0000000000..82035d9314 --- /dev/null +++ b/.changeset/shy-houses-pump.md @@ -0,0 +1,5 @@ +--- +'@lg-tools/lint': patch +--- + +Bumps prettier version to 2.8.8 diff --git a/STYLEGUIDE.md b/STYLEGUIDE.md index b9bd07c4d1..70cc3c44c5 100644 --- a/STYLEGUIDE.md +++ b/STYLEGUIDE.md @@ -55,7 +55,7 @@ export const someConstant = { optionTwo = 'option 2', } as const; -export type someConstant = typeof someConstant[keyof typeof someConstant]; +export type someConstant = (typeof someConstant)[keyof typeof someConstant]; ``` #### Avoid diff --git a/packages/badge/src/Badge/types.ts b/packages/badge/src/Badge/types.ts index 6fdcf97b77..87440e46a2 100644 --- a/packages/badge/src/Badge/types.ts +++ b/packages/badge/src/Badge/types.ts @@ -28,4 +28,4 @@ export const Variant = { Green: 'green', } as const; -export type Variant = typeof Variant[keyof typeof Variant]; +export type Variant = (typeof Variant)[keyof typeof Variant]; diff --git a/packages/banner/src/Banner/types.ts b/packages/banner/src/Banner/types.ts index 68344b841f..b35e631233 100644 --- a/packages/banner/src/Banner/types.ts +++ b/packages/banner/src/Banner/types.ts @@ -8,7 +8,7 @@ export const Variant = { Success: 'success', } as const; -export type Variant = typeof Variant[keyof typeof Variant]; +export type Variant = (typeof Variant)[keyof typeof Variant]; export interface BannerProps extends HTMLElementProps<'div', never>, diff --git a/packages/button/src/types.ts b/packages/button/src/types.ts index 8344f14c63..c938e3166d 100644 --- a/packages/button/src/types.ts +++ b/packages/button/src/types.ts @@ -11,7 +11,7 @@ export const Variant = { BaseGreen: 'baseGreen', } as const; -export type Variant = typeof Variant[keyof typeof Variant]; +export type Variant = (typeof Variant)[keyof typeof Variant]; /** * Size variants @@ -25,7 +25,7 @@ export const Size = { Large: 'large', }; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; // TODO: Remove in next major release export const FontSize = { @@ -33,7 +33,7 @@ export const FontSize = { Body2: 16, } as const; -export type FontSize = typeof FontSize[keyof typeof FontSize]; +export type FontSize = (typeof FontSize)[keyof typeof FontSize]; export interface ButtonProps { // Would prefer to use Pick<> to extract these properties, but they would not be correctly imported into Storybook otherwise. diff --git a/packages/callout/src/Callout/types.ts b/packages/callout/src/Callout/types.ts index 0ea762ff94..6ab1c2e743 100644 --- a/packages/callout/src/Callout/types.ts +++ b/packages/callout/src/Callout/types.ts @@ -9,7 +9,7 @@ export const Variant = { Example: 'example', } as const; -export type Variant = typeof Variant[keyof typeof Variant]; +export type Variant = (typeof Variant)[keyof typeof Variant]; export interface CalloutProps extends HTMLElementProps<'div'> { /** diff --git a/packages/card/src/Card/types.ts b/packages/card/src/Card/types.ts index fce8dccb2f..8ca456253c 100644 --- a/packages/card/src/Card/types.ts +++ b/packages/card/src/Card/types.ts @@ -5,7 +5,7 @@ export const ContentStyle = { Clickable: 'clickable', } as const; -export type ContentStyle = typeof ContentStyle[keyof typeof ContentStyle]; +export type ContentStyle = (typeof ContentStyle)[keyof typeof ContentStyle]; export interface CardProps extends DarkModeProps, HTMLElementProps<'div'> { /** diff --git a/packages/code/src/Code/Code.types.ts b/packages/code/src/Code/Code.types.ts index ae748842d9..85edc34d48 100644 --- a/packages/code/src/Code/Code.types.ts +++ b/packages/code/src/Code/Code.types.ts @@ -5,7 +5,7 @@ export const ScrollState = { Both: 'both', } as const; -export type ScrollState = typeof ScrollState[keyof typeof ScrollState]; +export type ScrollState = (typeof ScrollState)[keyof typeof ScrollState]; export type DetailedElementProps = React.DetailedHTMLProps< React.HTMLAttributes, diff --git a/packages/code/src/languages.ts b/packages/code/src/languages.ts index 92d95490e4..ca47c697b4 100644 --- a/packages/code/src/languages.ts +++ b/packages/code/src/languages.ts @@ -92,4 +92,4 @@ export const SupportedLanguages = { } as const; export type SupportedLanguages = - typeof SupportedLanguages[keyof typeof SupportedLanguages]; + (typeof SupportedLanguages)[keyof typeof SupportedLanguages]; diff --git a/packages/code/src/types.ts b/packages/code/src/types.ts index 52db03b44b..90fa57d7dc 100644 --- a/packages/code/src/types.ts +++ b/packages/code/src/types.ts @@ -7,14 +7,14 @@ export const Mode = { Dark: 'dark', } as const; -export type Mode = typeof Mode[keyof typeof Mode]; +export type Mode = (typeof Mode)[keyof typeof Mode]; export const Language = { ...SupportedLanguages, None: 'none', } as const; -export type Language = typeof Language[keyof typeof Language]; +export type Language = (typeof Language)[keyof typeof Language]; export type LineHighlightingDefinition = ReadonlyArray< number | readonly [number, number] diff --git a/packages/combobox/src/Combobox.types.ts b/packages/combobox/src/Combobox.types.ts index 0e837b5be1..c8b4bad8ac 100644 --- a/packages/combobox/src/Combobox.types.ts +++ b/packages/combobox/src/Combobox.types.ts @@ -17,7 +17,7 @@ export const ComboboxElement = { Menu: 'Menu', } as const; export type ComboboxElement = - typeof ComboboxElement[keyof typeof ComboboxElement]; + (typeof ComboboxElement)[keyof typeof ComboboxElement]; /** * Prop types @@ -29,7 +29,7 @@ export const ComboboxSize = { Default: 'default', Large: 'large', } as const; -export type ComboboxSize = typeof ComboboxSize[keyof typeof ComboboxSize]; +export type ComboboxSize = (typeof ComboboxSize)[keyof typeof ComboboxSize]; export const TruncationLocation = { start: 'start', @@ -38,7 +38,7 @@ export const TruncationLocation = { none: 'none', } as const; export type TruncationLocation = - typeof TruncationLocation[keyof typeof TruncationLocation]; + (typeof TruncationLocation)[keyof typeof TruncationLocation]; export const Overflow = { /** @@ -54,20 +54,20 @@ export const Overflow = { */ expandX: 'expand-x', } as const; -export type Overflow = typeof Overflow[keyof typeof Overflow]; +export type Overflow = (typeof Overflow)[keyof typeof Overflow]; export const State = { none: 'none', error: 'error', } as const; -export type State = typeof State[keyof typeof State]; +export type State = (typeof State)[keyof typeof State]; export const SearchState = { unset: 'unset', error: 'error', loading: 'loading', } as const; -export type SearchState = typeof SearchState[keyof typeof SearchState]; +export type SearchState = (typeof SearchState)[keyof typeof SearchState]; /** * Generic Typing diff --git a/packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts b/packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts index 3305e6bbfe..64e959da5f 100644 --- a/packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts +++ b/packages/confirmation-modal/src/ConfirmationModal/ConfirmationModal.types.ts @@ -5,7 +5,7 @@ export const Variant = { Danger: 'danger', } as const; -export type Variant = typeof Variant[keyof typeof Variant]; +export type Variant = (typeof Variant)[keyof typeof Variant]; export interface ConfirmationModalProps extends Omit { /** diff --git a/packages/copyable/src/Copyable/Copyable.types.ts b/packages/copyable/src/Copyable/Copyable.types.ts index fd53344d30..f232fb2c9e 100644 --- a/packages/copyable/src/Copyable/Copyable.types.ts +++ b/packages/copyable/src/Copyable/Copyable.types.ts @@ -5,7 +5,7 @@ export const Size = { Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export interface CopyableProps extends HTMLElementProps<'div'> { /** diff --git a/packages/empty-state/src/EmptyState.story.tsx b/packages/empty-state/src/EmptyState.story.tsx index 108773e836..2556239985 100644 --- a/packages/empty-state/src/EmptyState.story.tsx +++ b/packages/empty-state/src/EmptyState.story.tsx @@ -26,7 +26,7 @@ const StoryVariant = { ThreeFeatures: 'Three Features', } as const; -type StoryVariant = typeof StoryVariant[keyof typeof StoryVariant]; +type StoryVariant = (typeof StoryVariant)[keyof typeof StoryVariant]; type StoryProps = BasicEmptyStateProps & FeaturesEmptyStateProps & { variant: StoryVariant }; diff --git a/packages/guide-cue/src/types.ts b/packages/guide-cue/src/types.ts index f909014752..54aef6cebe 100644 --- a/packages/guide-cue/src/types.ts +++ b/packages/guide-cue/src/types.ts @@ -9,7 +9,7 @@ export const TooltipAlign = { Right: Align.Right, } as const; -export type TooltipAlign = typeof TooltipAlign[keyof typeof TooltipAlign]; +export type TooltipAlign = (typeof TooltipAlign)[keyof typeof TooltipAlign]; export const TooltipJustify = { Start: Justify.Start, @@ -17,7 +17,8 @@ export const TooltipJustify = { End: Justify.End, } as const; -export type TooltipJustify = typeof TooltipJustify[keyof typeof TooltipJustify]; +export type TooltipJustify = + (typeof TooltipJustify)[keyof typeof TooltipJustify]; // Exclude these from tooltip (tooltip already extends popover props) type ModifiedTooltipProps = Omit< diff --git a/packages/icon-button/src/types.ts b/packages/icon-button/src/types.ts index 65c32722ac..30a809e64b 100644 --- a/packages/icon-button/src/types.ts +++ b/packages/icon-button/src/types.ts @@ -7,7 +7,7 @@ export const Size = { XLarge: 'xlarge', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; // Since applications can't yet tree-shake, we're duplicating this interface from the types in the namespaces within the Icon package rather than importing the Icon package. // TODO: Import {IconProps} from '.../icon` diff --git a/packages/icon/src/glyphCommon.ts b/packages/icon/src/glyphCommon.ts index 46faceb72a..3f16c0535a 100644 --- a/packages/icon/src/glyphCommon.ts +++ b/packages/icon/src/glyphCommon.ts @@ -5,7 +5,7 @@ export const Size = { XLarge: 'xlarge', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export const sizeMap: Record = { small: 14, diff --git a/packages/lib/src/DarkModeProps/index.ts b/packages/lib/src/DarkModeProps/index.ts index e80a3ef32c..76d2ebf241 100644 --- a/packages/lib/src/DarkModeProps/index.ts +++ b/packages/lib/src/DarkModeProps/index.ts @@ -13,4 +13,4 @@ export default interface DarkModeProps { } export const Theme = { Light: 'light', Dark: 'dark' } as const; -export type Theme = typeof Theme[keyof typeof Theme]; +export type Theme = (typeof Theme)[keyof typeof Theme]; diff --git a/packages/lib/src/index.ts b/packages/lib/src/index.ts index b645562cb7..5efc1a09b8 100644 --- a/packages/lib/src/index.ts +++ b/packages/lib/src/index.ts @@ -164,7 +164,7 @@ export const AriaCurrentValue = { } as const; export type AriaCurrentValue = - typeof AriaCurrentValue[keyof typeof AriaCurrentValue]; + (typeof AriaCurrentValue)[keyof typeof AriaCurrentValue]; /** * Accepts a type as an argument and makes all of the keys of the type optional diff --git a/packages/loading-indicator/src/Spinner/Spinner.types.ts b/packages/loading-indicator/src/Spinner/Spinner.types.ts index 998306fdc4..88a1dbb0bf 100644 --- a/packages/loading-indicator/src/Spinner/Spinner.types.ts +++ b/packages/loading-indicator/src/Spinner/Spinner.types.ts @@ -8,7 +8,7 @@ export const DisplayOption = { XlargeVertical: 'xlarge-vertical', }; -export type DisplayOption = typeof DisplayOption[keyof typeof DisplayOption]; +export type DisplayOption = (typeof DisplayOption)[keyof typeof DisplayOption]; export interface SpinnerProps extends DarkModeProps, HTMLElementProps<'div'> { /** diff --git a/packages/logo/src/Logo.tsx b/packages/logo/src/Logo.tsx index 830edc38c2..841133dc43 100644 --- a/packages/logo/src/Logo.tsx +++ b/packages/logo/src/Logo.tsx @@ -22,7 +22,7 @@ export const LogoNames = [ 'UniversityLogoLockup', ] as const; -export type LogoName = typeof LogoNames[number]; +export type LogoName = (typeof LogoNames)[number]; interface GenericLogoProps extends LogoProps { /** diff --git a/packages/logo/src/utils.ts b/packages/logo/src/utils.ts index b782ce4954..2a2163fe9f 100644 --- a/packages/logo/src/utils.ts +++ b/packages/logo/src/utils.ts @@ -9,7 +9,7 @@ const SupportedColors = { GreenBase: 'green-base', } as const; -type SupportedColors = typeof SupportedColors[keyof typeof SupportedColors]; +type SupportedColors = (typeof SupportedColors)[keyof typeof SupportedColors]; const SupportedColorsMap: Record = { [SupportedColors.White]: palette.white, @@ -19,7 +19,7 @@ const SupportedColorsMap: Record = { } as const; type SupportedColorsMap = - typeof SupportedColorsMap[keyof typeof SupportedColorsMap]; + (typeof SupportedColorsMap)[keyof typeof SupportedColorsMap]; export { SupportedColors, SupportedColorsMap }; diff --git a/packages/marketing-modal/src/MarketingModal/types.ts b/packages/marketing-modal/src/MarketingModal/types.ts index 0c52126b47..7ce3b32aaf 100644 --- a/packages/marketing-modal/src/MarketingModal/types.ts +++ b/packages/marketing-modal/src/MarketingModal/types.ts @@ -6,14 +6,14 @@ export const BlobPosition = { BottomRight: 'bottom right', } as const; -export type BlobPosition = typeof BlobPosition[keyof typeof BlobPosition]; +export type BlobPosition = (typeof BlobPosition)[keyof typeof BlobPosition]; export const GraphicStyle = { Center: 'center', Fill: 'fill', } as const; -export type GraphicStyle = typeof GraphicStyle[keyof typeof GraphicStyle]; +export type GraphicStyle = (typeof GraphicStyle)[keyof typeof GraphicStyle]; export interface MarketingModalProps extends Omit { /** diff --git a/packages/menu/src/types.ts b/packages/menu/src/types.ts index 057979a0c3..2df0974b50 100644 --- a/packages/menu/src/types.ts +++ b/packages/menu/src/types.ts @@ -3,7 +3,7 @@ export const Size = { Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export type ElementOf< T extends React.ComponentType>, diff --git a/packages/modal/src/Modal/Modal.types.ts b/packages/modal/src/Modal/Modal.types.ts index 3eb0aa3af5..fd322b7e5d 100644 --- a/packages/modal/src/Modal/Modal.types.ts +++ b/packages/modal/src/Modal/Modal.types.ts @@ -8,7 +8,8 @@ export const CloseIconColor = { Light: 'light', }; -export type CloseIconColor = typeof CloseIconColor[keyof typeof CloseIconColor]; +export type CloseIconColor = + (typeof CloseIconColor)[keyof typeof CloseIconColor]; export const ModalSize = { Small: 'small', @@ -16,7 +17,7 @@ export const ModalSize = { Large: 'large', } as const; -export type ModalSize = typeof ModalSize[keyof typeof ModalSize]; +export type ModalSize = (typeof ModalSize)[keyof typeof ModalSize]; export type ForwardedRef = | React.ForwardedRef diff --git a/packages/number-input/src/NumberInput/NumberInput.types.ts b/packages/number-input/src/NumberInput/NumberInput.types.ts index 9e21521fc0..64010d4418 100644 --- a/packages/number-input/src/NumberInput/NumberInput.types.ts +++ b/packages/number-input/src/NumberInput/NumberInput.types.ts @@ -12,14 +12,14 @@ export const Direction = { Decrement: 'decrement', } as const; -export type Direction = typeof Direction[keyof typeof Direction]; +export type Direction = (typeof Direction)[keyof typeof Direction]; export const State = { Error: 'error', None: 'none', } as const; -export type State = typeof State[keyof typeof State]; +export type State = (typeof State)[keyof typeof State]; export const Size = { XSmall: 'xsmall', @@ -27,7 +27,7 @@ export const Size = { Default: 'default', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export interface UnitOption { displayName: string; diff --git a/packages/palette/src/Palette.story.tsx b/packages/palette/src/Palette.story.tsx index 88cf26839c..f59cb33802 100644 --- a/packages/palette/src/Palette.story.tsx +++ b/packages/palette/src/Palette.story.tsx @@ -26,7 +26,7 @@ const ShadeNames = [ 'light2', 'light3', ] as const; -type ShadeName = typeof ShadeNames[number]; +type ShadeName = (typeof ShadeNames)[number]; interface ColorBlockProps extends HTMLElementProps<'div'> { hue: HueName; diff --git a/packages/password-input/src/PasswordInput/PasswordInput.types.ts b/packages/password-input/src/PasswordInput/PasswordInput.types.ts index 107975659e..0b52b27a42 100644 --- a/packages/password-input/src/PasswordInput/PasswordInput.types.ts +++ b/packages/password-input/src/PasswordInput/PasswordInput.types.ts @@ -10,7 +10,7 @@ export const State = { None: 'none', // gray checkmark, gray text } as const; -export type State = typeof State[keyof typeof State]; +export type State = (typeof State)[keyof typeof State]; export const Size = { Small: 'small', @@ -18,7 +18,7 @@ export const Size = { Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export interface NotificationProps { notification?: string; diff --git a/packages/pipeline/src/types.ts b/packages/pipeline/src/types.ts index ce48bbca47..04306c8f10 100644 --- a/packages/pipeline/src/types.ts +++ b/packages/pipeline/src/types.ts @@ -9,7 +9,7 @@ export const Size = { Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export interface StateForStyles { hasHiddenStages: boolean; diff --git a/packages/popover/src/types.ts b/packages/popover/src/types.ts index 10a8700383..fe84df63da 100644 --- a/packages/popover/src/types.ts +++ b/packages/popover/src/types.ts @@ -17,7 +17,7 @@ const Align = { CenterHorizontal: 'center-horizontal', } as const; -type Align = typeof Align[keyof typeof Align]; +type Align = (typeof Align)[keyof typeof Align]; export { Align }; @@ -36,7 +36,7 @@ const Justify = { Fit: 'fit', } as const; -type Justify = typeof Justify[keyof typeof Justify]; +type Justify = (typeof Justify)[keyof typeof Justify]; export { Justify }; diff --git a/packages/radio-box-group/src/types.ts b/packages/radio-box-group/src/types.ts index 348727e75a..856d40ec93 100644 --- a/packages/radio-box-group/src/types.ts +++ b/packages/radio-box-group/src/types.ts @@ -6,7 +6,7 @@ export const Size = { Full: 'full', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export interface RadioBoxProps extends Omit, 'size'> { /** diff --git a/packages/radio-group/src/types.ts b/packages/radio-group/src/types.ts index a18ddb0912..cae1bc34c6 100644 --- a/packages/radio-group/src/types.ts +++ b/packages/radio-group/src/types.ts @@ -4,4 +4,4 @@ export const Size = { Default: 'default', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; diff --git a/packages/ripple/src/utils.ts b/packages/ripple/src/utils.ts index c81747ff7c..22954c2a73 100644 --- a/packages/ripple/src/utils.ts +++ b/packages/ripple/src/utils.ts @@ -6,7 +6,7 @@ const Variant = { DangerOutline: 'dangerOutline', } as const; -type Variant = typeof Variant[keyof typeof Variant]; +type Variant = (typeof Variant)[keyof typeof Variant]; export { Variant }; diff --git a/packages/search-input/src/SearchInput.story.tsx b/packages/search-input/src/SearchInput.story.tsx index a89c3e8239..b4c16cd22e 100644 --- a/packages/search-input/src/SearchInput.story.tsx +++ b/packages/search-input/src/SearchInput.story.tsx @@ -179,7 +179,7 @@ const data = [ export const LiveExample: StoryFn = ( args: SearchInputProps, ) => { - const [currentPage, setPage] = useState(); + const [currentPage, setPage] = useState<(typeof data)[0]>(); const [searchResults, setSearchResults] = useState(data); const handleChange: ChangeEventHandler = e => { diff --git a/packages/search-input/src/SearchInput/SearchInput.types.ts b/packages/search-input/src/SearchInput/SearchInput.types.ts index 0bf04cfdb0..f700f7a663 100644 --- a/packages/search-input/src/SearchInput/SearchInput.types.ts +++ b/packages/search-input/src/SearchInput/SearchInput.types.ts @@ -12,7 +12,7 @@ export const State = { Loading: 'loading', } as const; -export type State = typeof State[keyof typeof State]; +export type State = (typeof State)[keyof typeof State]; export const Size = { Small: 'small', @@ -20,7 +20,7 @@ export const Size = { Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; interface BaseSearchInputProps extends DarkModeProps, diff --git a/packages/segmented-control/src/SegmentedControl/SegmentedControl.types.ts b/packages/segmented-control/src/SegmentedControl/SegmentedControl.types.ts index babdf1d263..913309794a 100644 --- a/packages/segmented-control/src/SegmentedControl/SegmentedControl.types.ts +++ b/packages/segmented-control/src/SegmentedControl/SegmentedControl.types.ts @@ -7,7 +7,8 @@ export const DeprecatedSize = { Small: 'small', } as const; -export type DeprecatedSize = typeof DeprecatedSize[keyof typeof DeprecatedSize]; +export type DeprecatedSize = + (typeof DeprecatedSize)[keyof typeof DeprecatedSize]; export const Size = { XSmall: 'xsmall', @@ -15,7 +16,7 @@ export const Size = { Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export interface SegmentedControlProps extends Omit, 'onChange'> { diff --git a/packages/select/src/types.ts b/packages/select/src/types.ts index 219f2c19fe..cfb1c13ebe 100644 --- a/packages/select/src/types.ts +++ b/packages/select/src/types.ts @@ -9,13 +9,13 @@ export const Size = { Default: 'default', Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; export const State = { None: 'none', Error: 'error', } as const; -export type State = typeof State[keyof typeof State]; +export type State = (typeof State)[keyof typeof State]; export const DropdownWidthBasis = { Trigger: 'trigger', @@ -23,7 +23,7 @@ export const DropdownWidthBasis = { } as const; export type DropdownWidthBasis = - typeof DropdownWidthBasis[keyof typeof DropdownWidthBasis]; + (typeof DropdownWidthBasis)[keyof typeof DropdownWidthBasis]; interface BaseSelectProps extends Omit< diff --git a/packages/skeleton-loader/src/Skeleton/Skeleton.types.ts b/packages/skeleton-loader/src/Skeleton/Skeleton.types.ts index e4a0ae8c62..a0bd09e1a2 100644 --- a/packages/skeleton-loader/src/Skeleton/Skeleton.types.ts +++ b/packages/skeleton-loader/src/Skeleton/Skeleton.types.ts @@ -14,4 +14,4 @@ export const Size = { Large: 'large', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; diff --git a/packages/split-button/src/SplitButton/SplitButton.types.ts b/packages/split-button/src/SplitButton/SplitButton.types.ts index 6f98425216..09e891c4e2 100644 --- a/packages/split-button/src/SplitButton/SplitButton.types.ts +++ b/packages/split-button/src/SplitButton/SplitButton.types.ts @@ -30,21 +30,21 @@ export const Variant = { Danger: ButtonVariants.Danger, } as const; -export type Variant = typeof Variant[keyof typeof Variant]; +export type Variant = (typeof Variant)[keyof typeof Variant]; export const Align = { Top: ImportedAlign.Top, Bottom: ImportedAlign.Bottom, } as const; -export type Align = typeof Align[keyof typeof Align]; +export type Align = (typeof Align)[keyof typeof Align]; export const Justify = { Start: ImportedJustify.Start, End: ImportedJustify.End, } as const; -export type Justify = typeof Justify[keyof typeof Justify]; +export type Justify = (typeof Justify)[keyof typeof Justify]; // TODO: remove `href` and `as` when Button is updated to use `InferredPolymorphic` // https://jira.mongodb.org/browse/LG-3260 diff --git a/packages/stepper/src/types.ts b/packages/stepper/src/types.ts index ad48da3131..3a24a0c284 100644 --- a/packages/stepper/src/types.ts +++ b/packages/stepper/src/types.ts @@ -14,7 +14,7 @@ export const Mode = { Light: 'light', Dark: 'dark', } as const; -export type Mode = typeof Mode[keyof typeof Mode]; +export type Mode = (typeof Mode)[keyof typeof Mode]; export enum StepStates { CompletedMultiple = 'completed-multiple', diff --git a/packages/table/src/Cell/HeaderCell/HeaderCell.types.ts b/packages/table/src/Cell/HeaderCell/HeaderCell.types.ts index 670fb0019b..e83be9cbf2 100644 --- a/packages/table/src/Cell/HeaderCell/HeaderCell.types.ts +++ b/packages/table/src/Cell/HeaderCell/HeaderCell.types.ts @@ -11,7 +11,7 @@ export const SortState = { None: 'none', } as const; -export type SortState = typeof SortState[keyof typeof SortState]; +export type SortState = (typeof SortState)[keyof typeof SortState]; export interface SortStates { [key: string]: SortState; diff --git a/packages/table/src/TableV10/Table.tsx b/packages/table/src/TableV10/Table.tsx index cb31f0124f..363b236a67 100644 --- a/packages/table/src/TableV10/Table.tsx +++ b/packages/table/src/TableV10/Table.tsx @@ -94,7 +94,7 @@ const ScrollState = { Both: 'both', } as const; -type ScrollState = typeof ScrollState[keyof typeof ScrollState]; +type ScrollState = (typeof ScrollState)[keyof typeof ScrollState]; /** * @deprecated diff --git a/packages/table/src/TableV10/TableContext.tsx b/packages/table/src/TableV10/TableContext.tsx index 21512eadd0..cfadc089b5 100644 --- a/packages/table/src/TableV10/TableContext.tsx +++ b/packages/table/src/TableV10/TableContext.tsx @@ -16,7 +16,8 @@ const TableActionTypes = { /** * @deprecated */ -type TableActionTypes = typeof TableActionTypes[keyof typeof TableActionTypes]; +type TableActionTypes = + (typeof TableActionTypes)[keyof typeof TableActionTypes]; export { TableActionTypes }; @@ -56,7 +57,7 @@ const DataType = { Date: 'date', } as const; -type DataType = typeof DataType[keyof typeof DataType]; +type DataType = (typeof DataType)[keyof typeof DataType]; export { DataType }; diff --git a/packages/text-area/src/TextArea/TextArea.types.ts b/packages/text-area/src/TextArea/TextArea.types.ts index a801859724..08c78f7f60 100644 --- a/packages/text-area/src/TextArea/TextArea.types.ts +++ b/packages/text-area/src/TextArea/TextArea.types.ts @@ -6,7 +6,7 @@ export const State = { Error: 'error', } as const; -export type State = typeof State[keyof typeof State]; +export type State = (typeof State)[keyof typeof State]; export interface BaseTextAreaProps extends HTMLElementProps<'textarea', HTMLTextAreaElement> { diff --git a/packages/text-input/src/TextInput/TextInput.types.ts b/packages/text-input/src/TextInput/TextInput.types.ts index 74bdf92619..6db5468a3f 100644 --- a/packages/text-input/src/TextInput/TextInput.types.ts +++ b/packages/text-input/src/TextInput/TextInput.types.ts @@ -7,7 +7,7 @@ export const State = { Error: 'error', } as const; -export type State = typeof State[keyof typeof State]; +export type State = (typeof State)[keyof typeof State]; export const TextInputType = { Email: 'email', @@ -19,7 +19,7 @@ export const TextInputType = { Number: 'number', } as const; -export type TextInputType = typeof TextInputType[keyof typeof TextInputType]; +export type TextInputType = (typeof TextInputType)[keyof typeof TextInputType]; export const SizeVariant = { XSmall: 'xsmall', @@ -28,7 +28,7 @@ export const SizeVariant = { Large: 'large', } as const; -export type SizeVariant = typeof SizeVariant[keyof typeof SizeVariant]; +export type SizeVariant = (typeof SizeVariant)[keyof typeof SizeVariant]; export const TextInputFontSize = { ...BaseFontSize, @@ -36,7 +36,7 @@ export const TextInputFontSize = { } as const; export type TextInputFontSize = - typeof TextInputFontSize[keyof typeof TextInputFontSize]; + (typeof TextInputFontSize)[keyof typeof TextInputFontSize]; interface AriaLabelProps { /** diff --git a/packages/toast/src/Toast.types.ts b/packages/toast/src/Toast.types.ts index 737fad9f44..a8ebde43c3 100644 --- a/packages/toast/src/Toast.types.ts +++ b/packages/toast/src/Toast.types.ts @@ -6,7 +6,7 @@ const Variant = { Progress: 'progress', } as const; -type Variant = typeof Variant[keyof typeof Variant]; +type Variant = (typeof Variant)[keyof typeof Variant]; export { Variant }; diff --git a/packages/toggle/src/Toggle/types.ts b/packages/toggle/src/Toggle/types.ts index f5ff690fa2..e1dbe85ca2 100644 --- a/packages/toggle/src/Toggle/types.ts +++ b/packages/toggle/src/Toggle/types.ts @@ -6,7 +6,7 @@ export const Size = { XSmall: 'xsmall', } as const; -export type Size = typeof Size[keyof typeof Size]; +export type Size = (typeof Size)[keyof typeof Size]; interface BaseToggleProps { /** diff --git a/packages/tokens/src/index.ts b/packages/tokens/src/index.ts index ec21162f7a..555a283619 100644 --- a/packages/tokens/src/index.ts +++ b/packages/tokens/src/index.ts @@ -4,6 +4,7 @@ export { default as fontFamilies } from './fontFamilies'; export { default as fontWeights } from './fontWeights'; export { default as hoverRing } from './hoverRing'; export { Mode } from './mode'; +export { Size } from './size'; export { default as spacing } from './spacing'; export { default as transitionDuration } from './transitions'; export { BaseFontSize, default as typeScales } from './typeScales'; diff --git a/packages/tokens/src/mode.ts b/packages/tokens/src/mode.ts index 916bdb530c..e7a4ee4012 100644 --- a/packages/tokens/src/mode.ts +++ b/packages/tokens/src/mode.ts @@ -3,6 +3,6 @@ const Mode = { Light: 'light', } as const; -type Mode = typeof Mode[keyof typeof Mode]; +type Mode = (typeof Mode)[keyof typeof Mode]; export { Mode }; diff --git a/packages/tokens/src/size.ts b/packages/tokens/src/size.ts new file mode 100644 index 0000000000..e8ea51f265 --- /dev/null +++ b/packages/tokens/src/size.ts @@ -0,0 +1,8 @@ +export const Size = { + XSmall: 'xsmall', + Small: 'small', + Default: 'default', + Large: 'large', +} as const; + +export type Size = (typeof Size)[keyof typeof Size]; diff --git a/packages/tokens/src/typeScales.ts b/packages/tokens/src/typeScales.ts index ed325867b7..137fa462c9 100644 --- a/packages/tokens/src/typeScales.ts +++ b/packages/tokens/src/typeScales.ts @@ -3,7 +3,7 @@ export const BaseFontSize = { Body2: 16, } as const; -export type BaseFontSize = typeof BaseFontSize[keyof typeof BaseFontSize]; +export type BaseFontSize = (typeof BaseFontSize)[keyof typeof BaseFontSize]; /** * Defines font sizes and line heights of common typographic elements. diff --git a/packages/tooltip/src/Tooltip/Tooltip.types.ts b/packages/tooltip/src/Tooltip/Tooltip.types.ts index 29c41b187d..11c0988843 100644 --- a/packages/tooltip/src/Tooltip/Tooltip.types.ts +++ b/packages/tooltip/src/Tooltip/Tooltip.types.ts @@ -14,7 +14,7 @@ export const TriggerEvent = { Click: 'click', } as const; -export type TriggerEvent = typeof TriggerEvent[keyof typeof TriggerEvent]; +export type TriggerEvent = (typeof TriggerEvent)[keyof typeof TriggerEvent]; export const Align = { Top: PopoverAlign.Top, @@ -23,7 +23,7 @@ export const Align = { Right: PopoverAlign.Right, } as const; -export type Align = typeof Align[keyof typeof Align]; +export type Align = (typeof Align)[keyof typeof Align]; export { Justify }; diff --git a/packages/typography/src/Link/Link.types.ts b/packages/typography/src/Link/Link.types.ts index 55f5011ef6..043310701f 100644 --- a/packages/typography/src/Link/Link.types.ts +++ b/packages/typography/src/Link/Link.types.ts @@ -11,7 +11,7 @@ const ArrowAppearance = { None: 'none', } as const; -type ArrowAppearance = typeof ArrowAppearance[keyof typeof ArrowAppearance]; +type ArrowAppearance = (typeof ArrowAppearance)[keyof typeof ArrowAppearance]; export { ArrowAppearance }; diff --git a/tools/lint/package.json b/tools/lint/package.json index 74ac25f07f..1353db8954 100644 --- a/tools/lint/package.json +++ b/tools/lint/package.json @@ -33,7 +33,7 @@ "eslint-plugin-storybook": "0.6.12", "npm-package-json-lint": "7.0.0", "npm-package-json-lint-config-default": "6.0.0", - "prettier": "2.8.1" + "prettier": "2.8.8" }, "peerDependencies": { "typescript": "^4.6.3" diff --git a/tools/validate/src/builds/modules.types.ts b/tools/validate/src/builds/modules.types.ts index fad082969c..f94fef9511 100644 --- a/tools/validate/src/builds/modules.types.ts +++ b/tools/validate/src/builds/modules.types.ts @@ -6,4 +6,4 @@ export const ModuleType = { amd: 'amd', steal: 'steal', } as const; -export type ModuleType = typeof ModuleType[keyof typeof ModuleType]; +export type ModuleType = (typeof ModuleType)[keyof typeof ModuleType]; diff --git a/yarn.lock b/yarn.lock index b923cf8e26..d7adccea09 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10832,12 +10832,7 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier@2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc" - integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg== - -prettier@^2.7.1, prettier@^2.8.0, prettier@^2.8.7: +prettier@2.8.8, prettier@^2.7.1, prettier@^2.8.0, prettier@^2.8.7: version "2.8.8" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==