以下文件在TS环境中运行,怎么写声明文件?
var WechatAPI = require('wechat-api');
var api = new WechatAPI(appid, appsecret);
api.updateRemark('open_id', 'remarked', function (err, data, res) {
// TODO
});
声明文件是这样吗?
declare class WechatAPI {
constructor(id: string, secret: string);
updateRemark(): void;
}
引用的时候:
import {WechatAPI} from "wechat-api";
const api = new WechatAPI(wechatAppID, wechatAppSecret);
为什么到了转换成js文件就变成这样了?
const wechat_api_1 = require("wechat-api");
const api = new wechat_api_1.WechatAPI(wechatAppID, wechatAppSecret);//这里出错了
这是整个需要写声明文件的地址,https://github.com/node-webot...