【发布时间】:2018-11-08 23:59:22
【问题描述】:
我有三个文件:
a.js
var moduleb=require('./b.js')
moduleb.func('should_be_a_string_and_return_a_boolen')
b.js
function func(arg){
return arg
}
module.exports={func}
b.d.ts
declare function fnc(arg:string):boolean
问题:
我如何让 TypeScript 编译器理解 b.d.ts 中的类型定义并将其连接到 b.js 中的导出值?
我想要达到什么目的?
我正在使用create-react-app,我想将类型定义添加到组件中,以便我可以在组件的所有道具中获得 IntelliSense。
谢谢!
【问题讨论】:
标签: javascript reactjs typescript create-react-app