Skip to content

Commit 5f9b715

Browse files
committed
fix: resolve typescript warnings
1 parent 3518e4a commit 5f9b715

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

packages/coreui-react/src/components/dropdown/CDropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { placementPropType } from '../../props'
1616
import type { Placements } from '../../types'
1717
import { isRTL } from '../../utils'
1818

19-
import type { Alignments } from './types'
19+
import type { Alignments, Directions } from './types'
2020
import { getNextActiveElement, getPlacement } from './utils'
2121

2222
export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIElement> {

packages/coreui-react/src/components/dropdown/utils.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import type { Placement } from '@popperjs/core'
22
import type { Placements } from '../../types'
3-
import type { Alignments } from './types'
3+
import type { Alignments, Breakpoints } from './types'
44

5-
export const getAlignmentClassNames = (alignment: object | string) => {
5+
export const getAlignmentClassNames = (alignment: Alignments) => {
66
const classNames: string[] = []
77
if (typeof alignment === 'object') {
8-
Object.keys(alignment).map((key) => {
9-
classNames.push(`dropdown-menu${key === 'xs' ? '' : `-${key}`}-${alignment[key]}`)
10-
})
8+
9+
for (const key in alignment) {
10+
classNames.push(`dropdown-menu${key === 'xs' ? '' : `-${key}`}-${alignment[key as keyof Breakpoints]}`)
11+
}
1112
}
1213

1314
if (typeof alignment === 'string') {

packages/coreui-react/src/components/nav/CNavGroup.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import React, {
1010
import PropTypes from 'prop-types'
1111
import classNames from 'classnames'
1212
import { Transition } from 'react-transition-group'
13+
import type { TransitionStatus } from 'react-transition-group'
1314

1415
import { CNavContext } from '../sidebar/CSidebarNav'
1516
export interface CNavGroupProps {
@@ -51,9 +52,7 @@ export const CNavGroup = forwardRef<HTMLLIElement, CNavGroupProps>(
5152
const { visibleGroup, setVisibleGroup } = useContext(CNavContext)
5253

5354
const [_visible, setVisible] = useState(
54-
Boolean(
55-
visible || (idx && visibleGroup && isInVisibleGroup(visibleGroup, idx)),
56-
),
55+
Boolean(visible || (idx && visibleGroup && isInVisibleGroup(visibleGroup, idx))),
5756
)
5857

5958
useEffect(() => {
@@ -100,6 +99,7 @@ export const CNavGroup = forwardRef<HTMLLIElement, CNavGroupProps>(
10099
entered: { display: 'block', height: height },
101100
exiting: { display: 'block', height: height },
102101
exited: { height: height },
102+
unmounted: {}
103103
}
104104

105105
return (
@@ -124,7 +124,10 @@ export const CNavGroup = forwardRef<HTMLLIElement, CNavGroupProps>(
124124
className={classNames('nav-group-items', {
125125
compact: compact,
126126
})}
127-
style={{ ...style, ...transitionStyles[state] }}
127+
style={{
128+
...style,
129+
...transitionStyles[state as TransitionStatus],
130+
}}
128131
ref={navItemsRef}
129132
>
130133
{React.Children.map(children, (child, index) => {

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"noImplicitThis": true,
1515
"noImplicitAny": true,
1616
"strictNullChecks": true,
17-
"suppressImplicitAnyIndexErrors": true,
1817
"noUnusedLocals": true,
1918
"noUnusedParameters": true,
2019
"esModuleInterop": true,

0 commit comments

Comments
 (0)