「 JS 」 June 12, 2019
TypeScript 高级技巧
Words count 8.4k Reading time 8 mins.
用了一段时间的 typescript 之后,深感中大型项目中 typescript 的必要性,它能够提前在编译期避免许多 bug,如很恶心的拼写问题。而越来越多的 package 也开始使用 ts,学习 ts 已是势在必行。
keyof 与 Object.keys 略有相似,只不过 keyof 取 interface 的键。
interface Point {
x: number;
y: number;
}
// type keys = "x" ...
Read article