typescript中引用better-scroll,代码如下
import * as BScroll from 'better-scroll'
...
console.log(BScroll)
new BScroll('.wrapper')
...
控制台输出
{default: ƒ, __esModule: true}
> default:ƒ BScroll(el, options)
__esModule:true
> __proto__:Object
> Uncaught TypeError: BScroll is not a constructor
...
检查作者package.json中types声明没问题
...
"types": "./types/index.d.ts",
...
检查作者*.d.ts没问题
...
declare const BScroll: BScrollStatic;
declare module 'better-scroll' {
export = BScroll;
}
...
求助,我这里是哪里错误了?
慕雪6442864
忽然笑
相关分类