chore: remove useless any & add CSSProperties type (#43921)

This commit is contained in:
thinkasany 2023-08-01 01:26:41 +08:00 committed by GitHub
parent cc76cac953
commit 23040aa25f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 21 additions and 21 deletions

View File

@ -336,7 +336,7 @@ export default function Theme() {
...ThemeDefault, ...ThemeDefault,
themeType, themeType,
...ThemesInfo[themeType], ...ThemesInfo[themeType],
} as any; };
setThemeData(mergedData); setThemeData(mergedData);
form.setFieldsValue(mergedData); form.setFieldsValue(mergedData);
@ -517,13 +517,13 @@ export default function Theme() {
const posStyle: React.CSSProperties = { const posStyle: React.CSSProperties = {
position: 'absolute', position: 'absolute',
}; };
const leftTopImageStyle = { const leftTopImageStyle: React.CSSProperties = {
left: '50%', left: '50%',
transform: 'translate3d(-900px, 0, 0)', transform: 'translate3d(-900px, 0, 0)',
top: -100, top: -100,
height: 500, height: 500,
}; };
const rightBottomImageStyle = { const rightBottomImageStyle: React.CSSProperties = {
right: '50%', right: '50%',
transform: 'translate3d(750px, 0, 0)', transform: 'translate3d(750px, 0, 0)',
bottom: -100, bottom: -100,

View File

@ -25,7 +25,7 @@ const ColorStyle = () => {
if (index <= 10) { if (index <= 10) {
return ` return `
.palette-${color}-${index} { .palette-${color}-${index} {
background: ${(token as any)[`${color}-${index}`]}; background: ${token[`${color}-${index}`]};
} }
${makePalette(color, index + 1)} ${makePalette(color, index + 1)}
`; `;
@ -37,7 +37,7 @@ ${makePalette(color, index + 1)}
if (index <= 13) { if (index <= 13) {
return ` return `
.palette-gray-${index} { .palette-gray-${index} {
background: ${(gray as any)[index]}; background: ${gray[index]};
} }
${makeGrayPalette(index + 1)} ${makeGrayPalette(index + 1)}
`; `;

View File

@ -130,8 +130,8 @@ const showWaveEffect: ShowWaveEffect = (node, { className }) => {
// Create holder // Create holder
const holder = document.createElement('div'); const holder = document.createElement('div');
holder.style.position = 'absolute'; holder.style.position = 'absolute';
holder.style.left = `0px`; holder.style.left = '0px';
holder.style.top = `0px`; holder.style.top = '0px';
node?.insertBefore(holder, node?.firstChild); node?.insertBefore(holder, node?.firstChild);
render(<WaveEffect target={node} className={className} />, holder); render(<WaveEffect target={node} className={className} />, holder);

View File

@ -15,7 +15,7 @@ const App: React.FC = () => {
console.log(value.format('YYYY-MM-DD'), mode); console.log(value.format('YYYY-MM-DD'), mode);
}; };
const wrapperStyle = { const wrapperStyle: React.CSSProperties = {
width: 300, width: 300,
border: `1px solid ${token.colorBorderSecondary}`, border: `1px solid ${token.colorBorderSecondary}`,
borderRadius: token.borderRadiusLG, borderRadius: token.borderRadiusLG,

View File

@ -34,7 +34,7 @@ const getItems: (panelStyle: CSSProperties) => CollapseProps['items'] = (panelSt
const App: React.FC = () => { const App: React.FC = () => {
const { token } = theme.useToken(); const { token } = theme.useToken();
const panelStyle = { const panelStyle: React.CSSProperties = {
marginBottom: 24, marginBottom: 24,
background: token.colorFillAlter, background: token.colorFillAlter,
borderRadius: token.borderRadiusLG, borderRadius: token.borderRadiusLG,

View File

@ -128,7 +128,7 @@ describe('Drawer', () => {
}); });
it('style/drawerStyle/headerStyle/bodyStyle should work', () => { it('style/drawerStyle/headerStyle/bodyStyle should work', () => {
const style = { const style: React.CSSProperties = {
backgroundColor: '#08c', backgroundColor: '#08c',
}; };
const { container: wrapper } = render( const { container: wrapper } = render(

View File

@ -37,13 +37,13 @@ const items: MenuProps['items'] = [
const App: React.FC = () => { const App: React.FC = () => {
const { token } = useToken(); const { token } = useToken();
const contentStyle = { const contentStyle: React.CSSProperties = {
backgroundColor: token.colorBgElevated, backgroundColor: token.colorBgElevated,
borderRadius: token.borderRadiusLG, borderRadius: token.borderRadiusLG,
boxShadow: token.boxShadowSecondary, boxShadow: token.boxShadowSecondary,
}; };
const menuStyle = { const menuStyle: React.CSSProperties = {
boxShadow: 'none', boxShadow: 'none',
}; };

View File

@ -9,7 +9,7 @@ const AdvancedSearchForm = () => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const [expand, setExpand] = useState(false); const [expand, setExpand] = useState(false);
const formStyle = { const formStyle: React.CSSProperties = {
maxWidth: 'none', maxWidth: 'none',
background: token.colorFillAlter, background: token.colorFillAlter,
borderRadius: token.borderRadiusLG, borderRadius: token.borderRadiusLG,

View File

@ -18,7 +18,7 @@ const { Text } = Typography;
const { Option } = Select; const { Option } = Select;
const { RangePicker } = DatePicker; const { RangePicker } = DatePicker;
const narrowStyle = { const narrowStyle: React.CSSProperties = {
width: 50, width: 50,
}; };

View File

@ -196,7 +196,7 @@ const InternalTable = <RecordType extends AnyObject = AnyObject>(
const { childrenColumnName = 'children' } = mergedExpandable; const { childrenColumnName = 'children' } = mergedExpandable;
const expandType = React.useMemo<ExpandType>(() => { const expandType = React.useMemo<ExpandType>(() => {
if (rawData.some((item) => (item as any)?.[childrenColumnName])) { if (rawData.some((item) => item?.[childrenColumnName])) {
return 'nest'; return 'nest';
} }

View File

@ -60,7 +60,7 @@ const App: React.FC = () => {
const tagChild = tags.map(forMap); const tagChild = tags.map(forMap);
const tagPlusStyle = { const tagPlusStyle: React.CSSProperties = {
background: token.colorBgContainer, background: token.colorBgContainer,
borderStyle: 'dashed', borderStyle: 'dashed',
}; };

View File

@ -453,16 +453,16 @@ describe('Transfer', () => {
}); });
it('should add custom styles when their props are provided', () => { it('should add custom styles when their props are provided', () => {
const style = { const style: React.CSSProperties = {
backgroundColor: 'red', backgroundColor: 'red',
}; };
const leftStyle = { const leftStyle: React.CSSProperties = {
backgroundColor: 'blue', backgroundColor: 'blue',
}; };
const rightStyle = { const rightStyle: React.CSSProperties = {
backgroundColor: 'red', backgroundColor: 'red',
}; };
const operationStyle = { const operationStyle: React.CSSProperties = {
backgroundColor: 'yellow', backgroundColor: 'yellow',
}; };

View File

@ -251,7 +251,7 @@ describe('Typography', () => {
const onChange = jest.fn(); const onChange = jest.fn();
const className = 'test'; const className = 'test';
const style = { padding: 'unset' }; const style: React.CSSProperties = { padding: 'unset' };
const { container: wrapper } = render( const { container: wrapper } = render(
<Paragraph <Paragraph