Polymer中的“variable namespace is unclared”错误

问题描述 投票:0回答:1

我正在尝试在Polymer项目中创建一个新的帮助文件。

helper.html看起来像这样:

<script src="helper.ts"></script>

助手看起来像这样:

namespace my_namespace {
  export function foo(){}
}

我得到了几个错误,包括“变量命名空间未声明”,“解析错误。预期分号”,“变量missing_expression未声明”,“解析错误。预期主表达式”。

polymer-1.0
1个回答
0
投票

检查这些东西:

  1. 您的命名空间必须与BUILD文件中tf_web_library声明中的name字段匹配
  2. 将helper.html和helper.js文件添加到BUILD文件中。
  3. 在helper.html中,src字段应该是helper **。js ** not helper **。ts **
© www.soinside.com 2019 - 2024. All rights reserved.