我用TypeScript编写代码如下:
private initModel = () => {
let brandGoodId: number;
const getBrandGoodIdFunction = (window.parent as any).auditDisplay;
if (getBrandGoodIdFunction) {
brandGoodId = getBrandGoodIdFunction().brandGoodId;
console.log('get brandGoodId', brandGoodId);
} else {
console.log('window.auditDisplay is undefined!');
return;
}
getDisplayInfosByBgids(brandGoodId).then((displayInfoMap) => {
const displayInfo: DisplayInfo = (displayInfoMap.get(brandGoodId) as DisplayInfo);
this.modelInfo = toPopBufferComponent(displayInfo.components[0]);
this.loadModelMesh();
});
}
我有一个名为brandGoodId
的变量,它应该是let brandGoodId: number;
显示的数字。
但是当我测试已编译的js时,它会显示string
,如下所示:
编译后发生了什么?我想这是贝尔的问题?