Skip to content

Commit 3a2173a

Browse files
committed
replace ReactElement with ReactElement<any> in some places
1 parent 904aae3 commit 3a2173a

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

packages/__docs__/src/Nav/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ class Nav extends Component<NavProps, NavState> {
159159
}): React.ReactNode {
160160
if (
161161
React.isValidElement(children) &&
162-
React.Children.count(children.props.children) === 0
162+
React.Children.count(
163+
(children as React.ReactElement<any>).props.children
164+
) === 0
163165
) {
164166
return
165167
}

packages/__docs__/src/Select/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Select extends Component<SelectProps, SelectState> {
6565
getOptionData(options: React.ReactElement[]) {
6666
//TODO remove any
6767
const data: any = []
68-
Children.forEach(options, (child: ReactElement) => {
68+
Children.forEach(options, (child: ReactElement<any>) => {
6969
const { value, children, ...rest } = child.props
7070
data.push({ value, label: children, ...rest })
7171
})

packages/__docs__/src/compileMarkdown.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ const getHeadingId = (children: ReactNode): string => {
7171
const headingId = Children.toArray(children).reduce((id, child) => {
7272
if (typeof child === 'string') return id + child
7373

74-
if (isValidElement(child) && typeof (child.props as { children?: ReactNode }).children === 'string') {
74+
if (
75+
isValidElement(child) &&
76+
typeof (child.props as { children?: ReactNode }).children === 'string'
77+
) {
7578
return id + (child.props as { children: string }).children
7679
}
7780

@@ -184,9 +187,9 @@ const inferTypeAndLanguage = ({
184187
}
185188

186189
const renderer = (title?: string) => ({
187-
table: (table: ReactElement[]) => {
190+
table: (table: ReactElement<any>[]) => {
188191
const headCells = table?.[0]?.props?.children?.props?.children?.map(
189-
(el: ReactElement) => el?.props?.children?.[0]
192+
(el: ReactElement<any>) => el?.props?.children?.[0]
190193
)
191194
const body = table?.[1]?.props?.children
192195

@@ -202,9 +205,9 @@ const renderer = (title?: string) => ({
202205
</Table.Row>
203206
</Table.Head>
204207
<Table.Body>
205-
{body.map((tr: ReactElement) => (
208+
{body.map((tr: ReactElement<any>) => (
206209
<Table.Row key={uuid()}>
207-
{tr?.props?.children?.map((td: ReactElement) => (
210+
{tr?.props?.children?.map((td: ReactElement<any>) => (
208211
<Table.Cell key={uuid()}>
209212
{td?.props?.children?.map((child: ReactElement) => child)}
210213
</Table.Cell>
@@ -218,7 +221,7 @@ const renderer = (title?: string) => ({
218221
image: (href: string, title: string) => (
219222
<Img key={uuid()} src={href} alt={title} />
220223
),
221-
list: (list: ReactElement[], ordered: boolean) => {
224+
list: (list: ReactElement<any>[], ordered: boolean) => {
222225
if (list[0].props.children[0][0].type === 'code') {
223226
const code1 = list?.[0]?.props?.children?.[0]?.[0]?.props?.children
224227
const code2 = list?.[1]?.props?.children?.[0]?.[0]?.props?.children

packages/ui-top-nav-bar/src/TopNavBar/TopNavBarBreadcrumb/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ class TopNavBarBreadcrumb extends Component<
105105
)
106106
}
107107

108-
const breadcrumbElement = Children.toArray(children)[0] as ReactElement
108+
const breadcrumbElement = Children.toArray(children)[0] as ReactElement<any>
109109
const breadCrumbLinks = breadcrumbElement.props.children
110110
const lastButOneLink = Children.toArray(breadCrumbLinks)[
111111
Children.count(breadCrumbLinks) - 2
112-
] as ReactElement
112+
] as ReactElement<any>
113113

114114
return (
115115
this.context.inverseColor &&

packages/ui-tree-browser/src/TreeBrowser/TreeCollection/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class TreeCollection extends Component<
208208

209209
renderCollectionChildren(
210210
collectionId: string | number | undefined,
211-
child: ReactElement,
211+
child: ReactElement<any>,
212212
position: number,
213213
keyword: 'before' | 'after'
214214
) {

0 commit comments

Comments
 (0)