mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
chore: fix tsc (#45352)
This commit is contained in:
parent
bfa9addfce
commit
04cc086fb5
@ -1,6 +1,6 @@
|
||||
import { startTransition, useState } from 'react';
|
||||
|
||||
const useLayoutState = <S>(
|
||||
const useLayoutState: typeof useState = <S>(
|
||||
...args: Parameters<typeof useState<S>>
|
||||
): ReturnType<typeof useState<S>> => {
|
||||
const [state, setState] = useState<S>(...args);
|
||||
|
@ -101,7 +101,7 @@ export default function ThemePicker(props: ThemePickerProps) {
|
||||
onChange?.(theme);
|
||||
}}
|
||||
>
|
||||
<input type="radio" name="theme" id={index === 0 ? id : null} />
|
||||
<input type="radio" name="theme" id={index === 0 ? id : undefined} />
|
||||
<img src={url} alt={theme} />
|
||||
</label>
|
||||
<span>{locale[theme as keyof typeof locale]}</span>
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { Global, css } from '@emotion/react';
|
||||
import { useTheme } from 'antd-style';
|
||||
|
||||
const gray = {
|
||||
const gray: { [key: number]: string } = {
|
||||
1: '#fff',
|
||||
2: '#fafafa',
|
||||
3: '#f5f5f5',
|
||||
@ -25,7 +25,7 @@ const ColorStyle = () => {
|
||||
if (index <= 10) {
|
||||
return `
|
||||
.palette-${color}-${index} {
|
||||
background: ${token[`${color}-${index}`]};
|
||||
background: ${(token as any)[`${color}-${index}`]};
|
||||
}
|
||||
${makePalette(color, index + 1)}
|
||||
`;
|
||||
|
@ -7,7 +7,7 @@ const ltrD =
|
||||
const rtlD =
|
||||
'M256 64l512 0 0 128-128 0 0 768-128 0 0-768-128 0 0 768-128 0 0-448c-123.712 0-224-100.288-224-224s100.288-224 224-224zM960 896l-256-224 256-224z';
|
||||
|
||||
const DirectionIcon: React.FC<{ direction: DirectionType }> = (props) => (
|
||||
const DirectionIcon: React.FC<{ direction: DirectionType; className?: string }> = (props) => (
|
||||
<Icon {...props}>
|
||||
<svg viewBox="0 0 1024 1024" fill="currentColor">
|
||||
<path d={props.direction === 'ltr' ? ltrD : rtlD} />
|
||||
|
@ -45,7 +45,7 @@ const getAlgorithm = (themes: ThemeName[] = []) =>
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((item) => item);
|
||||
.filter((item) => item) as typeof antdTheme.darkAlgorithm[];
|
||||
|
||||
const GlobalLayout: React.FC = () => {
|
||||
const outlet = useOutlet();
|
||||
@ -109,7 +109,7 @@ const GlobalLayout: React.FC = () => {
|
||||
setSiteState({
|
||||
theme: _theme,
|
||||
direction: _direction === 'rtl' ? 'rtl' : 'ltr',
|
||||
bannerVisible: storedBannerVisibleLastTime ? storedBannerVisible : true,
|
||||
bannerVisible: storedBannerVisibleLastTime ? !!storedBannerVisible : true,
|
||||
});
|
||||
// Handle isMobile
|
||||
updateMobileMode();
|
||||
|
@ -57,7 +57,7 @@ const AffixTabs: React.FC = () => {
|
||||
const containerRef = React.useRef<HTMLDivElement>(null);
|
||||
const idsRef = React.useRef<string[]>([]);
|
||||
const [loaded, setLoaded] = React.useState(false);
|
||||
const [fixedId, setFixedId] = React.useState<string | null>(null);
|
||||
const [fixedId, setFixedId] = React.useState<string | undefined>(undefined);
|
||||
|
||||
const {
|
||||
styles: { affixTabs, affixTabsFixed, span },
|
||||
@ -100,7 +100,7 @@ const AffixTabs: React.FC = () => {
|
||||
}
|
||||
}
|
||||
|
||||
setFixedId(null);
|
||||
setFixedId(undefined);
|
||||
}
|
||||
|
||||
return throttle(doSync);
|
||||
|
@ -37,7 +37,7 @@ const Community: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const getEcosystemGroup = (): MenuProps['items'] => [
|
||||
export const getEcosystemGroup = (): Exclude<MenuProps['items'], undefined> => [
|
||||
{
|
||||
label: (
|
||||
<a href="https://charts.ant.design" target="_blank" rel="noopener noreferrer">
|
||||
|
@ -215,7 +215,8 @@ export default ({
|
||||
label: (
|
||||
<Link
|
||||
to={utils.getLocalizedPathname(
|
||||
blogList.sort((a, b) => (a.frontmatter.date > b.frontmatter.date ? -1 : 1))[0].link,
|
||||
blogList.sort((a, b) => (a.frontmatter?.date > b.frontmatter?.date ? -1 : 1))[0]
|
||||
.link,
|
||||
isZhCN,
|
||||
search,
|
||||
)}
|
||||
|
@ -11,6 +11,7 @@ export interface LangBtnProps {
|
||||
value: 1 | 2;
|
||||
pure?: boolean;
|
||||
onClick?: React.MouseEventHandler;
|
||||
['aria-label']?: string;
|
||||
}
|
||||
|
||||
const BASE_SIZE = '1.2em';
|
||||
|
@ -30,6 +30,11 @@ const locales = {
|
||||
shortMessage: '支付宝语雀 · 大学生公益计划火热进行中!',
|
||||
more: '了解更多',
|
||||
},
|
||||
en: {
|
||||
message: '',
|
||||
shortMessage: '',
|
||||
more: '',
|
||||
},
|
||||
};
|
||||
|
||||
const useStyle = createStyles(({ token, css }) => {
|
||||
|
Loading…
Reference in New Issue
Block a user