Thursday, August 17, 2017

declare keyword in TypeScript

I don't really understand namespaces or declare yet. If you have a namespace like Foo, you may use declare like so:

declare var Foo;

 
 

...and the reason to do this is if Foo is a regular JavaScript file (not TypeScript) looped in in the global namespace that you wish to make "ambient" everywhere.

No comments:

Post a Comment