Hi,
I am trying to use Typescript in Jet but I am a beginner in Typescript. I have some code in javascript that is working and I'm trying to adapt the code to Typescript. So from my javascript code I inserted this to my Typescript code:
viewModelParams['data'] = self.playersArray;
let viewPath = 'views/players/list.html';
let modelPath = 'viewModels/players/list';
let masterPromise = Promise.all([
moduleUtils.createView({'viewPath':viewPath}),
moduleUtils.createViewModel({'viewModelPath':modelPath})
]);
masterPromise.then(
function(values){
var viewModel = new values[1](viewModelParams);
self.moduleConfig({'view':values[0],'viewModel':viewModel});
}
);
I use this for navigating to a different view model and passing parameters to the view model. It builds my javascript but at runtime I get this error:
Uncaught (in promise) TypeError: values[1] is not a constructor
because of this line: var viewModel = new values[1](viewModelParams);
I'm wondering how do I translate this to Typescript or if there's another way to fix it and still pass parameters to the view model?
Thanks!