I've got an application that is migrated into typescript. In my index.html file I've got 2 files (actually, a lot more, but those are significant):
- static.js - which holds the declaration:
var staticData = {...};, built automatically bygrunt-jsongrunt task (nevermind what it does, it's just dynamically generated) - app.js - which is the typescript source dumped into js.
There is .ts a file that is used to build the app.js, which has following content:
mp.core.CoreModule
.constant('CONFIG', staticData.config)
.constant('lodash', _)
It's just declaring angular constants. When I try to compile this typescript file, I get following error:
Running "typescript:app" (typescript) task
>> app/modules/core/coreModuleConfig.ts(2,21): error TS2304: Cannot find name 's
taticData'.
>> app/modules/core/coreModuleConfig.ts(3,21): error TS2304: Cannot find name '_
'.
Warning: Task "typescript:app" failed. Use --force to continue.
I can understand the problem - typescript doesn't know what these variables are. The problem is that staticData is a js-file variable and I've got no idea how I can make those file cope with each other... Lodash' case is the same - it's loaded into the HTML as an external script.