Skip to content

Commit

Permalink
chore: improve compatibility with modern module resolution (#719)
Browse files Browse the repository at this point in the history
The modern "bundler" and "NodeNext" module resolution options do not support transitive dependencies properly, leading to errors such as "The inferred type of X cannot be named without reference to Y." A fix is possible by explicitly importing transitive types when they are re-exported.
  • Loading branch information
dextertanyj committed Jun 12, 2024
1 parent 2c65866 commit 850b997
Show file tree
Hide file tree
Showing 53 changed files with 107 additions and 36 deletions.
5 changes: 4 additions & 1 deletion react/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"extends": ["plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/no-unused-vars": "warn"
"@typescript-eslint/no-unused-vars": ["warn", {
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}]
}
},
{
Expand Down
1 change: 1 addition & 0 deletions react/src/Attachment/AttachmentError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useMemo } from 'react'
import { FileRejection } from 'react-dropzone'
import {
Button,
ComponentWithAs as _,
Flex,
forwardRef,
Stack,
Expand Down
1 change: 1 addition & 0 deletions react/src/Attachment/AttachmentFileInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useMemo, useState } from 'react'
import {
ComponentWithAs as _,
Flex,
forwardRef,
Image,
Expand Down
1 change: 1 addition & 0 deletions react/src/Badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Badge as ChakraBadge,
BadgeProps as ChakraBadgeProps,
ComponentWithAs as _,
createStylesContext,
forwardRef,
Icon,
Expand Down
1 change: 1 addition & 0 deletions react/src/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Button as ChakraButton,
ButtonProps as ChakraButtonProps,
ComponentWithAs as _,
forwardRef,
IconProps,
ThemingProps,
Expand Down
1 change: 1 addition & 0 deletions react/src/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ComponentWithAs as _,
forwardRef,
Stack,
StackDivider,
Expand Down
1 change: 1 addition & 0 deletions react/src/Calendar/CalendarBase/CalendarPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback } from 'react'
import {
chakra,
ComponentWithAs as _,
forwardRef,
Stack,
Text,
Expand Down
1 change: 1 addition & 0 deletions react/src/Calendar/CalendarBase/DayOfMonth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useCallback, useMemo } from 'react'
import {
ButtonProps,
chakra,
ComponentWithAs as _,
Flex,
forwardRef,
Skeleton,
Expand Down
1 change: 1 addition & 0 deletions react/src/Calendar/RangeCalendar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useCallback, useState } from 'react'
import {
ComponentWithAs as _,
forwardRef,
Stack,
StackDivider,
Expand Down
2 changes: 1 addition & 1 deletion react/src/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forwardRef } from '@chakra-ui/react'
import { ComponentWithAs as _, forwardRef } from '@chakra-ui/react'

import { CalendarProps } from '~/Calendar'

Expand Down
1 change: 1 addition & 0 deletions react/src/DatePicker/components/DatePickerInput.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from 'react'
import ReactInputMask from 'react-input-mask'
import {
ComponentWithAs as _,
forwardRef,
InputGroup,
InputRightAddon,
Expand Down
2 changes: 1 addition & 1 deletion react/src/DateRangePicker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { forwardRef } from '@chakra-ui/react'
import { ComponentWithAs as _, forwardRef } from '@chakra-ui/react'

import { RangeCalendarProps } from '~/Calendar'
import { DatePickerBaseProps } from '~/DatePicker'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from 'react'
import ReactInputMask from 'react-input-mask'
import {
ComponentWithAs as _,
Flex,
forwardRef,
Stack,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Flex, forwardRef, Popover, PopoverAnchor } from '@chakra-ui/react'
import {
ComponentWithAs as _,
Flex,
forwardRef,
Popover,
PopoverAnchor,
} from '@chakra-ui/react'

import { useDateRangePicker } from '../DateRangePickerContext'

Expand Down
1 change: 1 addition & 0 deletions react/src/FormControl/FormLabel/FormLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FC, useMemo } from 'react'
import {
Box,
chakra,
ComponentWithAs as _,
FormHelperText,
FormLabel as ChakraFormLabel,
FormLabelProps as ChakraFormLabelProps,
Expand Down
1 change: 1 addition & 0 deletions react/src/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react'
import {
ComponentWithAs as _,
forwardRef,
IconButton as ChakraIconButton,
IconButtonProps as ChakraIconButtonProps,
Expand Down
1 change: 1 addition & 0 deletions react/src/Input/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ComponentWithAs as _,
forwardRef,
Icon,
Input as ChakraInput,
Expand Down
4 changes: 2 additions & 2 deletions react/src/Menu/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@chakra-ui/react'
import { Meta, StoryFn } from '@storybook/react'

import { MenuVariant } from '~/theme/components/Menu'
import { Menu as MenuVariant } from '~/theme/components/Menu'

import { Menu, MenuButtonProps } from './Menu'

Expand All @@ -27,7 +27,7 @@ type MenuTemplateProps = MenuButtonProps & {
size?: ThemingProps<'Menu'>['size']
}
type MenuGroupTemplateProps = {
variant: MenuVariant
variant: keyof NonNullable<(typeof MenuVariant)['variants']>
size?: ThemingProps<'Menu'>['size']
}

Expand Down
4 changes: 4 additions & 0 deletions react/src/Menu/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { FC, useMemo } from 'react'
import {
ComponentWithAs as _,
Icon,
Menu as ChakraMenu,
MenuButton as ChakraMenuButton,
MenuDivider as ChakraMenuDivider,
MenuDividerProps,
MenuItem as ChakraMenuItem,
MenuItemProps,
MenuList as ChakraMenuList,
MenuListProps,
MenuProps as ChakraMenuProps,
ThemingProps,
useMultiStyleConfig,
Expand Down
1 change: 1 addition & 0 deletions react/src/NumberInput/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useRef } from 'react'
import {
Box,
chakra,
ComponentWithAs as _,
Divider,
forwardRef,
NumberInputProps as ChakraNumberInputProps,
Expand Down
1 change: 1 addition & 0 deletions react/src/PhoneNumberInput/IntlPhoneNumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { ChangeEvent, FC, useCallback, useMemo } from 'react'
import {
chakra,
ComponentWithAs as _,
createStylesContext,
Flex,
forwardRef,
Expand Down
6 changes: 5 additions & 1 deletion react/src/PhoneNumberInput/PhoneNumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
* https://www.npmjs.com/package/react-headless-phone-input but adapted for the
* application's needs.
*/
import { forwardRef, useControllableState } from '@chakra-ui/react'
import {
ComponentWithAs as _,
forwardRef,
useControllableState,
} from '@chakra-ui/react'
import { CountryCode, NationalNumber } from 'libphonenumber-js/min'

import { InputProps } from '~/Input'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ComponentWithAs as _,
forwardRef,
Icon,
InputGroup,
Expand Down
2 changes: 1 addition & 1 deletion react/src/PhoneNumberInput/utils/countrySelectUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CountryCode } from 'libphonenumber-js/types'
import { CountryCode } from 'libphonenumber-js'

/**
* Simple mapping constant retrieved from
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { chakra } from '@chakra-ui/react'
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const RestrictedGovtMastheadIcon = chakra(
(props: React.SVGProps<SVGSVGElement>): JSX.Element => {
Expand Down
1 change: 1 addition & 0 deletions react/src/Searchbar/Searchbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { KeyboardEvent, useCallback, useRef } from 'react'
import {
Box,
ComponentWithAs as _,
forwardRef,
Icon,
Input,
Expand Down
8 changes: 7 additions & 1 deletion react/src/Sidebar/SidebarHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Box, chakra, forwardRef, Icon } from '@chakra-ui/react'
import {
Box,
chakra,
ComponentWithAs as _,
forwardRef,
Icon,
} from '@chakra-ui/react'

import { useSidebarStyles } from './SidebarContext'
import type { BaseSidebarItemProps } from './types'
Expand Down
8 changes: 7 additions & 1 deletion react/src/Sidebar/SidebarItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { useMemo } from 'react'
import { Box, chakra, forwardRef, Icon } from '@chakra-ui/react'
import {
Box,
chakra,
ComponentWithAs as _,
forwardRef,
Icon,
} from '@chakra-ui/react'
import { dataAttr, isFunction } from '@chakra-ui/utils'
import { merge } from 'lodash'

Expand Down
1 change: 1 addition & 0 deletions react/src/Sidebar/SidebarList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Box,
chakra,
Collapse,
ComponentWithAs as _,
forwardRef,
HTMLChakraProps,
Icon,
Expand Down
2 changes: 2 additions & 0 deletions react/src/SingleSelect/utils/itemUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { As as _ } from '@chakra-ui/react'

import { ComboboxItem } from '../types'

export const itemIsObject = (
Expand Down
7 changes: 6 additions & 1 deletion react/src/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@

import { useMemo } from 'react'
import { useCheckbox, UseCheckboxProps } from '@chakra-ui/checkbox'
import { Icon, keyframes, usePrefersReducedMotion } from '@chakra-ui/react'
import {
ComponentWithAs as _,
Icon,
keyframes,
usePrefersReducedMotion,
} from '@chakra-ui/react'
import {
chakra,
forwardRef,
Expand Down
1 change: 1 addition & 0 deletions react/src/Tag/Tag.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Box,
chakra,
ComponentWithAs as _,
createStylesContext,
forwardRef,
HTMLChakraProps,
Expand Down
1 change: 1 addition & 0 deletions react/src/TagInput/TagInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { RovingTabIndexProvider } from 'react-roving-tabindex'
import {
Box,
ComponentWithAs as _,
forwardRef,
useControllableState,
useFormControl,
Expand Down
7 changes: 6 additions & 1 deletion react/src/TagInput/TagInputInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import {
useRef,
} from 'react'
import { useFocusEffect, useRovingTabIndex } from 'react-roving-tabindex'
import { chakra, forwardRef, useMergeRefs } from '@chakra-ui/react'
import {
chakra,
ComponentWithAs as _,
forwardRef,
useMergeRefs,
} from '@chakra-ui/react'

import { InputProps } from '~/Input'

Expand Down
1 change: 1 addition & 0 deletions react/src/Textarea/Textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import ResizeTextarea, { TextareaAutosizeProps } from 'react-textarea-autosize'
import {
ComponentWithAs as _,
forwardRef,
Textarea as ChakraTextarea,
TextareaProps as ChakraTextareaProps,
Expand Down
1 change: 1 addition & 0 deletions react/src/Toggle/Toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ReactNode, useMemo } from 'react'
import {
Box,
ComponentWithAs as _,
Flex,
forwardRef,
mergeThemeOverride,
Expand Down
4 changes: 2 additions & 2 deletions react/src/icons/BxBulb.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra } from '@chakra-ui/react'

// icon:bx-bulb | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxBulb = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
<svg
Expand Down
4 changes: 2 additions & 2 deletions react/src/icons/BxChevronDown.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra } from '@chakra-ui/react'

// icon:bx-chevron-down | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxChevronDown = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
<svg
Expand Down
4 changes: 2 additions & 2 deletions react/src/icons/BxChevronUp.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra } from '@chakra-ui/react'

// icon:bx-chevron-up | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxChevronUp = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
<svg
Expand Down
4 changes: 2 additions & 2 deletions react/src/icons/BxGitMerge.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra } from '@chakra-ui/react'

// icon:bx-git-merge | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxGitMerge = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
<svg
Expand Down
4 changes: 2 additions & 2 deletions react/src/icons/BxLinkExternal.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra } from '@chakra-ui/react'

// icon:bx-link-external | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxLinkExternal = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
<svg
Expand Down
4 changes: 2 additions & 2 deletions react/src/icons/BxLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { chakra } from '@chakra-ui/react'

// icon:bx-loader | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxLoader = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
<svg
Expand Down
2 changes: 1 addition & 1 deletion react/src/icons/BxMailSend.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// icon:bx-mail-send | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra } from '@chakra-ui/react'
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxMailSend = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
Expand Down
3 changes: 2 additions & 1 deletion react/src/icons/BxMinus.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { chakra } from '@chakra-ui/react'
// icon:bx-minus | Boxicons https://boxicons.com/ | Atisa
/** This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/) */
import { chakra, ChakraComponent as _ } from '@chakra-ui/react'

export const BxMinus = chakra((props: React.SVGProps<SVGSVGElement>) => {
return (
<svg
Expand Down
Loading

0 comments on commit 850b997

Please sign in to comment.