我将typescript更新到2.5.3版.现在我得到很多打字错误.我有以下简化情况:
export interface IClassHasMetaImplements {
prototype?: any;
}
export class UserPermissionModel implements IClassHasMetaImplements {
public test() {
}
}
Run Code Online (Sandbox Code Playgroud)
此代码声明引发以下错误: error TS2559: Type 'UserPermissionModel' has no properties in common with type 'IClassHasMetaImplements'.
任何人都可以帮我解决这个问题.
谢谢!
我尝试调整我的角度应用程序,为AOT编译和Tree Shaking(汇总)做好准备.但是我使用没有默认导出的模块(immutable.js,moment.js,...)会遇到问题.根据typscript(看这里),只能使用以下语句使用这些模块:import x = require('x')或者import * as x from 'x'
两个语句在汇总期间都会导致问题.在某些情况下,我在汇总期间收到错误:Cannot call a namespace ('x')在某些情况下,我收到运行时错误:x is undefined
在这里你可以找到我的rollup-config.js和tsconfig-aot.json tsconfig-aot_rollup-config.zip
在AOT编译和汇总期间,我需要一种方法来使用像immutable.js,moment.js这样的包.有没有办法做到这一点?
谢谢!
如果我在组件中更改有界对象的值,angular 会自动更新 UI 上的值。此更新过程需要几毫秒(取决于设备)。UI更新过程完成时是否有事件?
目前我使用以下代码:
// refresh binding
boundedItem = newValue;
// wait 100 milliseconds and the open the browsers print view
setTimeout(() => {
// open browser print view
}, 100);
Run Code Online (Sandbox Code Playgroud)
在慢速设备(智能手机)上,该过程可能需要 100 多毫秒,因此代码并不是很干净。