0
<script>
タグとウィンドウスコープ内のindex.htmlで定義されている外部変数を処理する必要があるアプリケーションを開発しています。私はいくつかの操作を行うために私のtypescriptファイルにアクセスする必要がありますが、コンパイル中に以下に示すエラーを表示しています。typescript 2.0で外部未定義変数を扱う方法
//index.html
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<script>
window.widgetResources = {
'sessionId': '2f60e0a2-3fa2-46f4-9a5c-4a8afe5007c8',
'staticResourceURL': 'http://localhost:9090/OfferFinder/16101/1/0/',
'offers': {
</script>
</head>
<body>
<app>loadings...</app>
</body>
</html>
//WidgetResourcesList.js
export class WidgetResourcesList {
//noinspection TypeScriptUnresolvedVariable
widgetResources = window.widgetResources;
}
//error getting
C:\quickstart>tsc
app/services/WidgetResourcesList.ts(5,28): error TS2339:
`Property 'widgetResources' does not exist on type 'Window'.`