git worktree
如果一个仓库里你有两个需求需要同时开发,你是不停地来回 checkout ?还是再 clone 一份仓库?多数人可能会选择后者,但实际上 git worktree 支持同时 checkout 多个分支,可以更好的支持这种场景。
SwitchHosts
一款方便用来管理和切换系统 hosts 的工具,简洁好用。(下载链接)
ThesatisfiesOperator
这是 TypeScript 4.9 新引进的操作符,可以用来声明表达式符合某个类型声明,同时保留表达式本身的具体类型推断。
“TypeScript developers are often faced with a dilemma: we want to ensure that some expression matches some type, but also want to keep the most specific type of that expression for inference purposes. ”
一个简单的例子:
const book1: Book = {
name: 'book',
price: 18
}
const book2 = {
name: 'book',
price: 18
} satisfies Book
interface Book {
name: string;
price?: number;
}
book1.price.toFixed() // 'book1.price' is possibly 'undefined'.(18048)
book2.price.toFixed() // good
11 Tips That Make You a Better Typescript Programmer
关于提升对 TypeScript 理解和运用的一些认知方式和实践技巧,比较精炼的一点小干货,对 TypeScript 新手来说应该会有比较大的收获,对于 TypeScript 的视野认识会扩大。