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 -

asp.net mvc - How to attach sql database to a javascript graph -

c# - How to know the number of Threads created and limit the Tasks accordingly -