{
getValue?: () => string,
value?: string
}
diff --git a/src/components/mdx-components/codeblock/highlight.tsx b/src/components/mdx-components/codeblock/highlight.tsx
index b38745e7..ff788614 100644
--- a/src/components/mdx-components/codeblock/highlight.tsx
+++ b/src/components/mdx-components/codeblock/highlight.tsx
@@ -5,7 +5,6 @@ import { useMemo } from 'react';
* This is a runtime version of React 17+ new JSX transform.
* So we are accessing those exports that "doesn't exist"
*/
-// @ts-expect-error -- This is something really stupid
import { Fragment, jsx, jsxs } from 'react/jsx-runtime';
import { toJsxRuntime } from 'hast-util-to-jsx-runtime';
@@ -87,7 +86,7 @@ interface LowlightProps {
}
export default function Lowlight({ code, language }: LowlightProps) {
- const tree = useMemo(() => toJsxRuntime(lowlight.highlight(language, code), { Fragment, jsx, jsxs }), [code, language]);
+ const tree = useMemo(() => toJsxRuntime(lowlight.highlight(language, code), { Fragment, jsx: jsx as any, jsxs: jsxs as any }), [code, language]);
return (
diff --git a/src/components/mdx-components/enhanced-codeblock/index.tsx b/src/components/mdx-components/enhanced-codeblock/index.tsx
index 63d62dd7..73081896 100644
--- a/src/components/mdx-components/enhanced-codeblock/index.tsx
+++ b/src/components/mdx-components/enhanced-codeblock/index.tsx
@@ -15,6 +15,7 @@ import { TabItem, Tabs } from '../../tabs';
import { buildCode, buildCatEOF } from './build-code';
import { useMirrorHttpsEnabled } from '@/contexts/mirror-enable-https';
import { useMirrorSudoEnabled } from '@/contexts/mirror-enable-sudo';
+import { EMPTY_ARRAY } from '../../../lib/client/constant';
interface CodeBlockProps {
isHttpProtocol?: boolean,
@@ -54,7 +55,7 @@ const createInitialState = (menus: Menu[]): Record => {
};
function CodeBlock({
- menus = [],
+ menus = EMPTY_ARRAY,
isHttpProtocol = true,
code,
codeLanguage,
@@ -89,11 +90,9 @@ function CodeBlock({
}, [code, httpsEnabled, isHttpProtocol, mirrorUrl, sudoEnabled, variableState]);
/** Validation */
- if (process.env.NODE_ENV !== 'production') {
- if (!code.includes('{{') && !enableQuickSetup) {
- // eslint-disable-next-line no-console -- log message
- console.warn('CodeBlock: If you don\' use {{variable}} syntax in your code, and don\'t use "enableQuickSetup", you don\'t have to use . The extraneous has code starts with:', code.split('\n')[0]);
- }
+ if (process.env.NODE_ENV !== 'production' && !code.includes('{{') && !enableQuickSetup) {
+ // eslint-disable-next-line no-console -- log message
+ console.warn('CodeBlock: If you don\' use {{variable}} syntax in your code, and don\'t use "enableQuickSetup", you don\'t have to use . The extraneous has code starts with:', code.split('\n')[0]);
}
const codeBlockMenu = menus.length > 0 && ;
diff --git a/src/components/mdx-components/heading.tsx b/src/components/mdx-components/heading.tsx
index b9d39562..b59016cb 100644
--- a/src/components/mdx-components/heading.tsx
+++ b/src/components/mdx-components/heading.tsx
@@ -5,6 +5,7 @@ import style9 from 'style9';
import type { StyleWithAtRulesAndFalsy } from '@/types/style9';
import headingAnchorStyles from './heading.module.css';
+import { EMPTY_ARRAY } from '../../lib/client/constant';
const styles = style9.create({
base: {
@@ -78,8 +79,8 @@ const styles = style9.create({
});
type HeadingProps = Omit<
-React.PropsWithChildren>,
-'className'
+ React.PropsWithChildren>,
+ 'className'
> & {
xstyle?: StyleWithAtRulesAndFalsy[],
isPageAnchor?: boolean,
@@ -89,7 +90,7 @@ React.PropsWithChildren>,
};
export const Heading = typescriptHappyForwardRef((
- { as, children, id, isPageAnchor = true, xstyle = [], ...props }: HeadingProps,
+ { as, children, id, isPageAnchor = true, xstyle = EMPTY_ARRAY, ...props }: HeadingProps,
ref: React.ForwardedRef | null
) => {
const label = typeof children === 'string' ? `Link for ${children}` : 'Link for this heading';
diff --git a/src/components/mdx-components/index.tsx b/src/components/mdx-components/index.ts
similarity index 100%
rename from src/components/mdx-components/index.tsx
rename to src/components/mdx-components/index.ts
diff --git a/src/components/mdx-components/inline.tsx b/src/components/mdx-components/inline.tsx
index aa191fc2..3c6465ba 100644
--- a/src/components/mdx-components/inline.tsx
+++ b/src/components/mdx-components/inline.tsx
@@ -42,24 +42,24 @@ const styles = style9.create({
}
});
-export const Strong = memo((p: JSX.IntrinsicElements['strong']) => (
+export const Strong = memo((p: React.JSX.IntrinsicElements['strong']) => (
));
-export const OL = memo((p: JSX.IntrinsicElements['ol']) => (
+export const OL = memo((p: React.JSX.IntrinsicElements['ol']) => (
));
-export const LI = memo((p: JSX.IntrinsicElements['li']) => (
+export const LI = memo((p: React.JSX.IntrinsicElements['li']) => (
));
-export const UL = memo((p: JSX.IntrinsicElements['ul']) => (
+export const UL = memo((p: React.JSX.IntrinsicElements['ul']) => (
));
-export const Divider = memo((p: JSX.IntrinsicElements['hr']) => (
+export const Divider = memo((p: React.JSX.IntrinsicElements['hr']) => (
));
-export const Code = memo((p: JSX.IntrinsicElements['code']) => (
+export const Code = memo((p: React.JSX.IntrinsicElements['code']) => (
));
-export const EM = memo((p: JSX.IntrinsicElements['em']) => (
+export const EM = memo((p: React.JSX.IntrinsicElements['em']) => (
));
diff --git a/src/components/mdx-components/link.tsx b/src/components/mdx-components/link.tsx
index 26a17ba1..4627f477 100644
--- a/src/components/mdx-components/link.tsx
+++ b/src/components/mdx-components/link.tsx
@@ -21,7 +21,7 @@ const styles = style9.create({
}
});
-function Link({ href, ...props }: Omit) {
+function Link({ href, ...props }: Omit) {
const processedHref = useMemo(() => {
if (typeof href !== 'string') {
return href;
diff --git a/src/components/mirrorz-logo/index.tsx b/src/components/mirrorz-logo/index.tsx
index 14fb2d72..e840ccb9 100644
--- a/src/components/mirrorz-logo/index.tsx
+++ b/src/components/mirrorz-logo/index.tsx
@@ -1,6 +1,6 @@
import { memo } from 'react';
-function MirrorZLogo(props: JSX.IntrinsicElements['svg']) {
+function MirrorZLogo(props: React.JSX.IntrinsicElements['svg']) {
return (