in my main html file I have defined the following which I want to be a project global variable :
<script type="text/javascript" charset="utf-8">var path='/';
path=path.substr(0, path.length - 1);
</script>
I am then using the variable path in several different ts files and it works fine. However, I do get a compilation warning saying that path is not defined. How can I prevent this warning from happening ?
Create a something.d.ts
file (.d.ts
is the file extension for type declarataion) and make sure that it's included or not excluded in your tsconfig.json
:
something.d.ts
declare var path: string;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With