以我自己的组件react-better-countdown
为例,
首先在package.json
里面添加types: types/index.d.ts
,
然后文件目录上添加对应文件夹和文件,
最后是index.d.ts
文件的编写,具体看代码:
import * as React from 'react'; interface CountdownProps { count"_blank" href="https://github.com/leeseean/react-better-countdown">https://github.com/leeseean/react-better-countdown顺便求个Star!