javascript - TypeScript: the variable is defined on the MVC page -


How can I make TypeScript aware that the variable is defined in cshtml file? Can I add a reference inside the TS file?

You can do this in a typewrite file or in one. D.ts file:

  var to MVC: declare string;  

It does not produce any code, but it conveys to the compiler that a variable named "fromMvc" exists. After declaring that you can use it as a normal variable.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -