File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
apps/site/components/Common/CodeBox Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 11'use client' ;
22
33import {
4- DocumentDuplicateIcon ,
54 CodeBracketIcon ,
5+ DocumentDuplicateIcon ,
66} from '@heroicons/react/24/outline' ;
77import classNames from 'classnames' ;
88import { useTranslations } from 'next-intl' ;
9- import type { FC , PropsWithChildren , ReactElement , ReactNode } from 'react' ;
9+ import type { FC , PropsWithChildren , ReactElement } from 'react' ;
1010import { Fragment , isValidElement , useRef } from 'react' ;
1111
1212import Button from '@/components/Common/Button' ;
@@ -16,10 +16,10 @@ import styles from './index.module.css';
1616
1717// Transforms a code element with plain text content into a more structured
1818// format for rendering with line numbers
19- const transformCode = (
20- code : ReactElement < PropsWithChildren > ,
19+ const transformCode = < T extends ReactElement < PropsWithChildren > > (
20+ code : T ,
2121 language : string
22- ) : ReactNode => {
22+ ) : ReactElement < HTMLElement > | T => {
2323 if ( ! isValidElement ( code ) ) {
2424 // Early return when the `CodeBox` child is not a valid element since the
2525 // type is a ReactNode, and can assume any value
You can’t perform that action at this time.
0 commit comments