Javascript 编译后,在if语句中键入脚本基本赋值

Javascript 编译后,在if语句中键入脚本基本赋值,javascript,typescript,angular,Javascript,Typescript,Angular,我试图从一开始,在编译了app.component.ts(版本1.8.2)之后,在app.component.js中发现了一个错误(功能?): if (d = decorators[i]) 在快速入门示例配置中,我没有发现哪里出错。 谢谢你的帮助 我的代码: app.component.ts 从'angular2/core'导入{Component}; @组成部分({ 选择器:“我的应用程序”, templateUrl:“/templates/AppComponent.html” }) 导出类

我试图从一开始,在编译了
app.component.ts
(版本1.8.2)之后,在
app.component.js
中发现了一个错误(功能?):

if (d = decorators[i])
在快速入门示例配置中,我没有发现哪里出错。 谢谢你的帮助

我的代码:

app.component.ts
从'angular2/core'导入{Component};
@组成部分({
选择器:“我的应用程序”,
templateUrl:“/templates/AppComponent.html”
})
导出类AppComponent{
public name:string=“我的测试应用程序”;
}
package.json
{
“名称”:“iSandBox”,
“版本”:“1.0.0”,
“脚本”:{
“开始”:“并发”npm运行tsc:w“npm运行grunt”和“npm运行lite”,
“tsc”:“tsc”,
“tsc:w”:“tsc-w”,
“lite”:“lite服务器”,
“打字”:“打字”,
“postinstall”:“typings安装”,
“咕噜”:“咕噜”
},
“许可证”:“ISC”,
“依赖项”:{
“angular2”:“2.0.0-beta.7”,
“systemjs”:“0.19.22”,
“es6承诺”:“^3.0.2”,
“es6垫片”:“^0.34.4”,
“反映元数据”:“0.1.3”,
“rxjs”:“5.0.0-beta.2”,
“zone.js”:“0.5.15”
},
“依赖性”:{
“同时”:“^2.0.0”,
“咕噜”:“^1.0.0-rc1”,
“grunt contrib副本”:“^0.8.2”,
“grunt contrib jshint”:“~1.0.0”,
“grunt contrib nodeunit”:“~0.4.1”,
“grunt contrib丑恶”:“~0.11.1”,
“吞咽”:“^3.9.1”,
“咕噜咕噜”:“^2.6.0”,
“吞咽重命名”:“^1.2.2”,
“大口喘息”:“^4.3.2”,
“狼吞虎咽”:“^1.5.3”,
“吞咽util”:“^3.0.7”,
“精简服务器”:“^2.1.0”,
“类型脚本”:“^1.7.5”,
“打字”:“^0.6.8”
},
“环境依赖项”:{
“es6垫片”:“github:DefinitelyTyped/DefinitelyTyped/es6垫片/es6垫片.d.ts#6697D6F7DADB5773CB40ECDA35A76027E0783B2”
}
}
tsconfig.json
{
“编译器选项”:{
“目标”:“es5”,
“模块”:“系统”,
“moduleResolution”:“节点”,
“源地图”:正确,
“emit decoromentadata”:正确,
“实验生态学者”:没错,
“removeComments”:false,
“noImplicitAny”:错误
},
“排除”:[
“节点_模块”,
“打字/主要”,
“打字/主要d.T”
]
}
app.component.js
System.register(['angular2/core'],
函数(导出\u 1、上下文\u 1){
“严格使用”;
var\uuu moduleName=context\u 1&&context\u 1.id;
变量uuu装饰=(此和此装饰)
||函数(装饰器、目标、键、描述){
var c=arguments.length,r=c<3?目标
:desc==null?desc=对象
.getOwnPropertyDescriptor(目标,键):描述,d;
if(typeof Reflect==“object”&&typeof Reflect.decoration==“function”)
r=反射.装饰(装饰者,目标,键,描述);
其他的
对于(var i=decorators.length-1;i>=0;i--)
/*==================此处===>>>>>*/if(d=decorators[i])
r=(c<3?d(r):c>3?d(目标,键,r):d(目标,键))|r;
返回
c>3&&r&&Object。定义属性(目标、键、r)、r;
};
var\uuuu元数据=(此和此。\uuuu元数据)
||函数(k,v){
if(typeof Reflect==“object”&&typeof Reflect.metadata==“function”)
返回反映元数据(k,v);
};
var core_1;
var-AppComponent;
返回{
setters:[函数(core_1_1){core_1=core_1_1;}],
执行:函数(){
AppComponent=(函数(){
函数AppComponent(){
this.name=“我的测试应用程序”;
}
AppComponent=\uuuu(
[core_1.2]组件({
选择器:“我的应用程序”,
templateUrl:“/templates/AppComponent.html”
}),
__元数据('design:paramtypes',[]),AppComponent);
返回AppComponent;
}());
出口1(“AppComponent”,AppComponent);
}
}
});
//#sourceMappingURL=app.component.js.map

测试中的赋值不一定是错误的。这:

if (d = decorators[i])
与此相同:

d = decorators[i];
if (d)
让我们看一下整个
if

if (d = decorators[i])
    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
if(d=decorators[i])
r=(c<3?d(r):c>3?d(目标,键,r):d(目标,键))|r;
如您所见,
if
的主体将
d
用作函数,因此这只是一个保护,以防止调用错误的东西(因此不是函数)


它只是在
装饰程序中循环,对于非虚假的装饰程序,调用它们。

测试中的赋值不一定是错误的。这:

if (d = decorators[i])
与此相同:

d = decorators[i];
if (d)
让我们看一下整个
if

if (d = decorators[i])
    r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
if(d=decorators[i])
r=(c<3?d(r):c>3?d(目标,键,r):d(目标,键))|r;
如您所见,
if
的主体将
d
用作函数,因此这只是一个保护,以防止调用错误的东西(因此不是函数)


它只是在
装饰程序中循环,对于不虚假的装饰程序,它会调用它们。

这有什么错?赋值和比较有什么错?这有什么错?赋值和比较有什么错?