Visual studios has the following typescript code on their website that I was trying to follow as an example:
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(...);
Part of the javascript code I have is:
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);
}
);
However when I do this I get an error that says that VSS_Service.getCollectionClient(TFS_Wit_WebApi.WorkItemTrackingHttpClient) is not a function. Do I need to initialize VSS_Service other than the VSS.require(["VSS/Service"]?
I made witClient and outside variable so I could use it anywhere in my program, and added Controls and Grids to the function which worked.