I have the following function in a file:
function alertWin(title, message) {
.......
.......
}
In another typescript file I have:
function mvcOnFailure(message) {
"use strict";
alertWin("Internal Application Error", message);
}
I am getting an error saying “alertwin” does not exist in the current scope.
Is the way to solve this for me to define this function in another file and then reference that? If so then what would the definition look like?
You can do this (assuming title and message are both supposed to be strings):
You could put this in the same file, or put it in a separate ambient definitions file (.d.ts) which you import:
Or, you could just import the other file that has the actual function definition, but you won’t get static typing support.