I've got some JavaScript code that I'm trying to convert to Typescript.
Supposedly, typescript is a superset of JavaScript, except the following has compiler errors. Assuming I didn't import the ko library into typescript, how would I convert the following code:
(function(ko, viewModels){
viewModels.MyViewModel = function(){
//stuff in here
}
}(ko, window.viewModels = window.viewModels || {}));
For references, this was my attempt in TypeScript
module viewModels {
export class PartDetailsViewModel {
public bar: string;
constructor (){
this.bar = ko.foo(); //<-- compiler error, "ko" does not exist in current scope
}
}
}
}