I created a new JS object in the cshtml file. I want to use TS interface validation on this object.
<script type="text/javascript">
var clusteredPins = [];
@foreach (var d in Model)
{
@:clusteredPins.push({latitude: @d.location.latitude});
}
I defined IClasteredPin interface in a interface.ts file but I don't see any way to use typescript in the cshtml file. My ideal code would look like this:
<script type="text/javascript">
var clusteredPins:IClasteredPin = [];
@foreach (var d in Model)
{
@:clusteredPins.push({latitude: @d.location.latitude});
}
There is a similar question but the answers are not what I am looking. I am not sure people who answered that question understands the problem. I don't want to run TS on client site. I want to use ts in cshtml like it was in a ts file.