【发布时间】:2017-12-19 03:18:18
【问题描述】:
我使用react/lib/update 方法和typescript。
我为它写了一个定义文件,像这样:
declare module 'react/lib/update' {
export default function update<S>(value: S, spec: any): S;
}
并且,像这样使用它:
import * as update from 'react/lib/update';
但是tsc给我一个错误:
Cannot invoke an expression whose type lacks a call signature. Type 'typeof 'react/lib/update'' has no compatible call signatures.
看来我的定义文件不正确。如何解决?
【问题讨论】:
标签: reactjs typescript typescript-typings typescript2.0