PHP within typescript file
<p>I need to populate some typescript arrays with PHP array values. Here is how I do it:</p>

<p>Relevant portion of index.php:</p>

<pre><code>&lt;?
    require 'scripts/back_end/database_connection.php';
    require 'scripts/back_end/get_countries.php';
    require 'scripts/back_end/views/select.php';
    require 'scripts/back_end/views/view.php';

    $conn-&gt;close();
?&gt;

&lt;script type="text/javascript"&gt;
    var allCountries = &lt;? echo json_encode($allCountries, JSON_PRETTY_PRINT) ?&gt;;
&lt;/script&gt;
</code></pre>

<p>I would much prefer to add the <code>var allCountries =</code> javascript line to my typescript file within this function like so:</p>

<pre><code>$(document).ready(function() {
    var allCountries = &lt;? echo json_encode($allCountries, JSON_PRETTY_PRINT) ?&gt;;
    var _searchFilterViewModel: SearchFilterViewModel = new SearchFilterViewModel(allCountries, allCategories);
    var _searchFilterForm = $("#find-vegan-products-page").find("form")[0];
    ko.applyBindings(_searchFilterViewModel, _searchFilterForm);
);
</code></pre>

<p>However the PHP tags are only recognised in javascript files. Is there ay way to let the php be recognised in typescript files?</p>