I have a javascript object which is built dynamically and contains my resources (strings of translation) for my app. It looks as follows:
var ResourceManager = (function () {
function ResourceManager() {
var currentLanguage = $('#activeLanguage').html();
this.resources = {
get Aanmelden() {
switch (currentLanguage) {
case "en-GB":
return "Register";
case "nl-NL":
return "Aanmelden";
default:
return "Aanmelden";
}
},
get AlgemeenOpslaan() {
switch (currentLanguage) {
case "en-GB":
return "Save";
case "nl-NL":
return "Opslaan";
default:
return "Opslaan";
}
}
};
}
return ResourceManager;
}());
The neat thing is that this way I can use intellisense to find my translations, just like the functionality provided by MVC. Is there a way to provide the same functionality when I am working in typescript? The main problem here is that I could do:
declare class ResourceManager {
}
This however does not give me intellisense for the methods of this class. The reason I use javascript and not typescript btw, is because if I dynamically build a typescript file, it does not seem to automatically compile this to the javascript file I want to send to the client.
Does anyone know either a way to fix this via a typescript resource file instead of javascript, or allowing my other typescript files to work with intellisense over the javascript object?