Skip to content

Commit

Permalink
chore(utils/react): get rid of ts-expect-error
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Aug 3, 2024
1 parent db6ab9c commit 1ee43e8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/utils/react/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,15 @@ export function wrapReactClass(node: any, prop: any = 'type') {

export function getReactRoot(o: HTMLElement | Element | Node) {
return (
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactContainer$')) as string] ||
// @ts-expect-error 7053
o['_reactRootContainer']?._internalRoot?.current
(o as any)[Object.keys(o).find((k) => k.startsWith('__reactContainer$')) as string] ||
(o as any)['_reactRootContainer']?._internalRoot?.current
);
}

export function getReactInstance(o: HTMLElement | Element | Node) {
return (
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactFiber')) as string] ||
// @ts-expect-error 7053
o[Object.keys(o).find((k) => k.startsWith('__reactInternalInstance')) as string]
(o as any)[Object.keys(o).find((k) => k.startsWith('__reactFiber')) as string] ||
(o as any)[Object.keys(o).find((k) => k.startsWith('__reactInternalInstance')) as string]
);
}

Expand Down

0 comments on commit 1ee43e8

Please sign in to comment.