taro2转taro3,typescript编译报错
-
报错图片:
报错代码:
import { PureComponent } from 'react' import PropTypes, { InferProps } from 'prop-types' import { View } from '@tarojs/components' import { CountdownProps, CountdownState } from '@/types/countdown' import CountdownItem from './item/index' const DAY_TO_SECONDS = 24 * 60 * 60 const HOUR_TO_SECONDS = 60 * 60 export default class ZtCountdown extends PureComponent<CountdownProps, CountdownState> { public static propTypes: InferProps<CountdownProps> public static defaultProps: CountdownProps constructor(props: CountdownProps) { super(props) this.state = { day: 0, hour: 0, minute: 0, second: 0, } as CountdownState } componentDidMount(): void { this.startCountDown() } // ... }
// package.json "@babel/core": "^7.1.2", "@babel/plugin-proposal-class-properties": "^7.1.0", "@babel/plugin-transform-react-jsx": "^7.0.0", "@babel/preset-env": "^7.1.0", "@jiahuix/mini-html-parser2": "^0.1.6", "@tarojs/cli": "~3.0.2", "@tarojs/components": "~3.0.2", "@tarojs/mini-runner": "~3.0.2", "@tarojs/plugin-babel": "^2.2.2", "@tarojs/plugin-csso": "^2.2.2", "@tarojs/plugin-sass": "^2.2.2", "@tarojs/plugin-uglifyjs": "^2.2.2", "@tarojs/react": "~3.0.2", "@tarojs/router": "^2.2.2", "@tarojs/runtime": "~3.0.2", "@tarojs/taro": "~3.0.2", "@tarojs/taro-alipay": "^2.2.2", "@tarojs/taro-h5": "^2.2.2", "@tarojs/taro-swan": "^2.2.2", "@tarojs/taro-weapp": "^2.2.2", "@tarojs/webpack-runner": "^2.2.2", "@types/react": "^16.8.20", "@types/react-dom": "^17.0.0", "@types/sinon": "^5.0.5", "@types/webpack-env": "^1.13.6", "@typescript-eslint/eslint-plugin": "^2.26.0", "@typescript-eslint/parser": "^2.26.0", "@vuepress/plugin-active-header-links": "^1.0.0-rc.1", "@vuepress/plugin-back-to-top": "^1.0.0-rc.1", "@vuepress/plugin-nprogress": "^1.0.0-rc.1", "@vuepress/plugin-search": "^1.0.0-rc.1", "axios": "^0.21.1", "babel-core": "^7.0.0-bridge.0", "babel-eslint": "^10.0.1", "babel-jest": "^23.6.0", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-jsx-stylesheet": "^0.6.5", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.1", "classnames": "^2.2.6", "cross-env": "^5.2.1", "eslint": "^6.8.0", "eslint-plugin-import": "^2.20.2", "eslint-plugin-react": "^7.19.0", "eslint-plugin-react-hooks": "^3.0.0", "highlight": "^0.2.4", "highlight.js": "^9.15.10", "husky": "^4.2.3", "jest": "^23.6.0", "lint-staged": "^8.0.3", "marked": "^1.2.8", "nerv-server": "^1.4.3", "nerv-test-utils": "^1.4.3", "nervjs": "^1.4.3", "prettier": "^2.2.1", "prop-types": "^15.7.2", "react": "^17.0.1", "regenerator-runtime": "^0.12.1", "simulant": "^0.2.2", "sinon": "^7.1.0", "stylus": "^0.54.8", "typescript": "~3.7.2", "vuepress": "^1.0.3"