{"id":2512,"date":"2022-08-30T15:25:29","date_gmt":"2022-08-30T15:25:29","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/27\/using-typescript-in-cshtml-files-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:25:29","modified_gmt":"2022-08-30T15:25:29","slug":"using-typescript-in-cshtml-files-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/using-typescript-in-cshtml-files-collection-of-common-programming-errors\/","title":{"rendered":"Using TypeScript in cshtml files-Collection of common programming errors"},"content":{"rendered":"<p>You could manually compile the TypeScript files using tsc.exe and then add the resulting Javascript to your project or use a tool, such as Web Essentials that compiles on save.<\/p>\n<p>As the compiler can be compiled to Javascript, you can also let the user&#8217;s browser do the compilation on the fly (at the cost of performance and file size, the compiler is fairly big). An example of this approach is niutech&#8217;s solution.<\/p>\n<p>If you are using Bundling and Minification, I have just released an implementation of IBundleTransform that compiles TypeScript to Javascript. It is on GitHub and NuGet (Install-Package TypeScriptBundleTransform). If you are not yet using Bundling and Minification, it is worth a look!<\/p>\n<p id=\"rop\"><small>Originally posted 2014-01-27 08:42:58. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>You could manually compile the TypeScript files using tsc.exe and then add the resulting Javascript to your project or use a tool, such as Web Essentials that compiles on save. As the compiler can be compiled to Javascript, you can also let the user&#8217;s browser do the compilation on the fly (at the cost of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2512","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2512"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2512\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}