This is the Javascript version of what I want to do in Typescript, with the important thing to note being the way in which I reference exports.inform from the exports.error function ("exports.inform"):
exports.error = function(_string, _kvp){
for(var _i = 0; _i < server.clients.length; _++i){
if(server.clients[_i] != undefined && server.clients[_i].isValid()){
exports.inform(server.clients[_i], _string, _kvp);
}
}
}
exports.inform = function(_client, _string, _kvp){
var _output = tag + processAll(_string, _kvp);
_client.printToChat(_output);
}
This is my equivalent in Typescript, but "export function inform" is being referrenced incorrectly within function 'error' ("inform"):
export function error(_str:string, _kvp:Object) {
for (var _i: number = 0; _i < server.clients.length; ++_i) {
if (server.clients[_i] != undefined && server.clients[_i].isValid()) {
inform(server.clients[_i], _str, _kvp);
}
}
}
export function inform(_client:Entity, _str:string, _kvp:Object) {
var _output = tag + processAll(_str, _kvp);
_client.printToChat(_output);
}
Sorry for the vague explanation, I hope you understand and will try to clarify if it's too hard to comprehend.
Edit: The error it was giving me was 'invalid call signature' caused by performing string concatenations within the argument, which TS apparently does not allow (unless in closed parenthesis), so Ryan's comment was correct: just call inform
. Thank you Nypan.