From fb5ed958531f4597bd3e8c348c3ed9dc223eadb3 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Mon, 20 Mar 2023 14:52:35 +0800 Subject: [PATCH] chore(deps): bump typescript to v5 (#41301) * chore(deps): bump typescript to v5 * fix * fix * type fix * Update components/statistic/demo/countdown.tsx Co-authored-by: MadCcc <1075746765@qq.com> * Update components/statistic/demo/countdown.tsx Co-authored-by: MadCcc <1075746765@qq.com> * fix * fix type * update demo --------- Co-authored-by: MadCcc <1075746765@qq.com> --- components/statistic/demo/countdown.tsx | 55 ++++++++++++------------- components/table/demo/virtual-list.tsx | 6 +-- package.json | 2 +- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/components/statistic/demo/countdown.tsx b/components/statistic/demo/countdown.tsx index 0615f07148..e0408c6ed7 100644 --- a/components/statistic/demo/countdown.tsx +++ b/components/statistic/demo/countdown.tsx @@ -1,37 +1,36 @@ -import React from 'react'; +import type { CountdownProps } from 'antd'; import { Col, Row, Statistic } from 'antd'; -import type { StatisticProps } from 'antd'; +import React from 'react'; const { Countdown } = Statistic; -const deadline = Date.now() + 1000 * 60 * 60 * 24 * 2 + 1000 * 30; // Dayjs is also OK -const App: React.FC = () => { - const onFinish = () => { - console.log('finished!'); - }; +const deadline = Date.now() + 1000 * 60 * 60 * 24 * 2 + 1000 * 30; // Dayjs is also OK - const onChange = (val: StatisticProps['value']) => { - if (val && 4.95 * 1000 < val && val < 5 * 1000) { - console.log('changed!'); - } - }; +const onFinish: CountdownProps['onFinish'] = () => { + console.log('finished!'); +}; - return ( - - - - - - - - - - - - - - - ); +const onChange: CountdownProps['onChange'] = (val) => { + if (typeof val === 'number' && 4.95 * 1000 < val && val < 5 * 1000) { + console.log('changed!'); + } }; +const App: React.FC = () => ( + + + + + + + + + + + + + + +); + export default App; diff --git a/components/table/demo/virtual-list.tsx b/components/table/demo/virtual-list.tsx index 61aa8485d8..fc125703c3 100644 --- a/components/table/demo/virtual-list.tsx +++ b/components/table/demo/virtual-list.tsx @@ -1,8 +1,8 @@ -import React, { useEffect, useRef, useState } from 'react'; -import { Table, theme } from 'antd'; import type { TableProps } from 'antd'; +import { Table, theme } from 'antd'; import classNames from 'classnames'; import ResizeObserver from 'rc-resize-observer'; +import React, { useEffect, useRef, useState } from 'react'; import { VariableSizeGrid as Grid } from 'react-window'; const VirtualTable = (props: TableProps) => { @@ -62,7 +62,7 @@ const VirtualTable = (props: TableProps) columnCount={mergedColumns.length} columnWidth={(index: number) => { const { width } = mergedColumns[index]; - return totalHeight > scroll!.y! && index === mergedColumns.length - 1 + return totalHeight > (scroll?.y as number) && index === mergedColumns.length - 1 ? (width as number) - scrollbarSize - 1 : (width as number); }} diff --git a/package.json b/package.json index 1edf183e12..9154abbe76 100644 --- a/package.json +++ b/package.json @@ -284,7 +284,7 @@ "terser": "^5.16.1", "ts-node": "^10.8.2", "typedoc": "^0.23.21", - "typescript": "~4.9.3", + "typescript": "~5.0.2", "vanilla-jsoneditor": "^0.16.0", "webpack-bundle-analyzer": "^4.1.0", "xhr-mock": "^2.4.1",