2020
10-08
10-08
为react组件库添加typescript类型提示的方法
以我自己的组件react-better-countdown为例,首先在package.json里面添加types:types/index.d.ts,,然后文件目录上添加对应文件夹和文件,最后是index.d.ts文件的编写,具体看代码:import*asReactfrom'react';interfaceCountdownProps{count?:number;dayText?:string|React.ReactElement;hourText?:string|React.ReactElement;minuteText?:string|React.ReactElement;secondText?...
继续阅读 >