How to debug typescript,
In Chrome, we need to press F12, open settings, uncheck the Enable JavaScript source maps
In IE, we can debug directly,
In Firefox, I haven't try.
Good Luck! ……
只会比较 实例成员
class Person {
public name: string;
}
class Animal {
public name: string;
}
let p: Person;
let a: Animal;
p = a;
a = p;
只能将 多 的属性赋值给 少 的,不可将 少 的属性 ...……
参考地址:https://blog.csdn.net/u012863664/article/details/77881921
先来一段Promise代码:
function timeout(ms:number){
return new Promise((resolveCallback, rejectCallback) =amp;amp;gt;{
...……
使用全局 window 上自定义的变更进,TypeScript 会报属性不存在,
console.log(window.foo) // ❌ Property ‘foo’ does not exist on type 'Window amp;amp;amp; typeof globalThis'.ts(2339)
需要将自定义变量 ...……