Skip to content

Commit

Permalink
fix(components): tsconfig移除suppressImplicitAnyIndexErrors,并修复相关错误
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxinssfd committed Aug 6, 2023
1 parent 2f11ce6 commit ea636c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export const CollapseTransition: React.FC<CollapseTransitionProps> = (
>;
const memorizedSize = useRef('');

const sizeType: 'max-width' | 'max-height' = useMemo(
() => (width ? 'max-width' : 'max-height'),
const sizeType: 'maxWidth' | 'maxHeight' = useMemo(
() => (width ? 'maxWidth' : 'maxHeight'),
[width],
);

Expand All @@ -40,7 +40,7 @@ export const CollapseTransition: React.FC<CollapseTransitionProps> = (

// el.style[sizeType] = 'none'; // css 未加 !important 时有效,无法添加 !important
// el.style.cssText = `${sizeType}: none!important;`; // 会导致行内样式丢失
el.style.setProperty(sizeType, 'none', 'important');
el.style.setProperty('max-width', 'none', 'important');
const w = el.offsetWidth + 'px';
el.style[sizeType] = '';
void el.offsetWidth;
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/icon/demo/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const App: React.FC = () => {
{holder}
{Object.keys(Icons).map((k) => (
<Tooltip key={k} title={k} destroyOnHide>
<Icon onClick={() => copy(k)}>{React.createElement(Icons[k])}</Icon>
<Icon onClick={() => copy(k)}>
{React.createElement(Icons[k as keyof typeof Icons])}
</Icon>
</Tooltip>
))}
</Space>
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

"allowJs": true,
"moduleResolution": "node",
"suppressImplicitAnyIndexErrors": true,
// "suppressImplicitAnyIndexErrors": true,
"strict": true,
"resolveJsonModule": true,

Expand Down

0 comments on commit ea636c1

Please sign in to comment.