Visual Studios 在他们的网站上有以下打字稿代码,我试图以此为例:
import RestClient = require("TFS/WorkItemTracking/RestClient");
// Get an instance of the client
var client = RestClient.getClient();
// Call a method on the client
// e.g. client.getResource(...).then(...);
我拥有的部分javascript代码是:
VSS.init({
explicitNotifyLoaded: true,
usePlatformStyles: true
});
VSS.require([
"VSS/Controls",
"VSS/Controls/Menus",
"VSS/Controls/Dialogs",
"VSS/Service",
"TFS/WorkItemTracking/RestClient",
"VSS/WebApi/Contracts"],
function (VSS_Service, TFS_Wit_WebApi) {
//get the REST client
var witClient = VSS_Service.getCollectionClient(TFS_Wit_WebApi.WorkItemTrackingHttpClient);
}
);
但是,当我这样做时,我收到一条错误消息,指出 VSS_Service.getCollectionClient(TFS_Wit_WebApi.WorkItemTrackingHttpClient) 不是函数。除了 VSS.require(["VSS/Service"] 之外,我还需要初始化 VSS_Service 吗?