chore: upgrade TypeScript 4.9 to 5.9, ESLint 8.29 to 8.57, @typescript-eslint 5 to 7
Resolves all TS2345/TS2347/TS7006 type errors introduced by stricter TypeScript 5.x. Fix Icons.Settings to Icons.Setting, cast account data returns, fix implicit any. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import React, {
|
||||
useState,
|
||||
} from 'react';
|
||||
import {
|
||||
DOMNode,
|
||||
Element,
|
||||
Text as DOMText,
|
||||
HTMLReactParserOptions,
|
||||
@@ -302,7 +303,7 @@ export function CodeBlock({
|
||||
hideTrack
|
||||
>
|
||||
<div id="code-block-content" className={css.CodeBlockInternal}>
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</div>
|
||||
</Scroll>
|
||||
{largeCodeBlock && !expanded && <Box className={css.CodeBlockBottomShadow} />}
|
||||
@@ -330,7 +331,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'h1') {
|
||||
return (
|
||||
<Text {...props} className={css.Heading} size="H2">
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -338,7 +339,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'h2') {
|
||||
return (
|
||||
<Text {...props} className={css.Heading} size="H3">
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -346,7 +347,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'h3') {
|
||||
return (
|
||||
<Text {...props} className={css.Heading} size="H4">
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -354,7 +355,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'h4') {
|
||||
return (
|
||||
<Text {...props} className={css.Heading} size="H4">
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -362,7 +363,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'h5') {
|
||||
return (
|
||||
<Text {...props} className={css.Heading} size="H5">
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -370,7 +371,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'h6') {
|
||||
return (
|
||||
<Text {...props} className={css.Heading} size="H6">
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -378,7 +379,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'p') {
|
||||
return (
|
||||
<Text {...props} className={classNames(css.Paragraph, css.MarginSpaced)} size="Inherit">
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -390,7 +391,7 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'blockquote') {
|
||||
return (
|
||||
<Text {...props} size="Inherit" as="blockquote" className={css.BlockQuote}>
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -398,23 +399,24 @@ export const getReactCustomHtmlParser = (
|
||||
if (name === 'ul') {
|
||||
return (
|
||||
<ul {...props} className={css.List}>
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
if (name === 'ol') {
|
||||
return (
|
||||
<ol {...props} className={css.List}>
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</ol>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'code') {
|
||||
if (parent && 'name' in parent && parent.name === 'pre') {
|
||||
const codeReact = domToReact(children, opts);
|
||||
const codeReact = domToReact(children as unknown as DOMNode[], opts);
|
||||
if (typeof codeReact === 'string') {
|
||||
let lang = props.className;
|
||||
let lang: string | undefined =
|
||||
typeof props.className === 'string' ? props.className : undefined;
|
||||
if (lang === 'language-rs') lang = 'language-rust';
|
||||
else if (lang === 'language-js') lang = 'language-javascript';
|
||||
else if (lang === 'language-ts') lang = 'language-typescript';
|
||||
@@ -435,13 +437,13 @@ export const getReactCustomHtmlParser = (
|
||||
} else {
|
||||
return (
|
||||
<Text as="code" size="T300" className={css.Code} {...props}>
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (name === 'a' && testMatrixTo(tryDecodeURIComponent(props.href))) {
|
||||
if (name === 'a' && testMatrixTo(tryDecodeURIComponent(String(props.href)))) {
|
||||
const content = children.find((child) => !(child instanceof DOMText))
|
||||
? undefined
|
||||
: children.map((c) => (c instanceof DOMText ? c.data : '')).join();
|
||||
@@ -449,7 +451,7 @@ export const getReactCustomHtmlParser = (
|
||||
const mention = renderMatrixMention(
|
||||
mx,
|
||||
roomId,
|
||||
tryDecodeURIComponent(props.href),
|
||||
tryDecodeURIComponent(String(props.href)),
|
||||
makeMentionCustomProps(params.handleMentionClick, content),
|
||||
);
|
||||
|
||||
@@ -471,14 +473,14 @@ export const getReactCustomHtmlParser = (
|
||||
aria-pressed={true}
|
||||
style={{ cursor: 'pointer' }}
|
||||
>
|
||||
{domToReact(children, opts)}
|
||||
{domToReact(children as unknown as DOMNode[], opts)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (name === 'img') {
|
||||
const htmlSrc = mxcUrlToHttp(mx, props.src, params.useAuthentication);
|
||||
if (htmlSrc && props.src.startsWith('mxc://') === false) {
|
||||
const htmlSrc = mxcUrlToHttp(mx, String(props.src), params.useAuthentication);
|
||||
if (htmlSrc && String(props.src).startsWith('mxc://') === false) {
|
||||
return (
|
||||
<a href={htmlSrc} target="_blank" rel="noreferrer noopener">
|
||||
{props.alt || props.title || htmlSrc}
|
||||
|
||||
Reference in New Issue
Block a user