hushicai / hushicai.github.io

Blog
https://hushicai.github.io
27 stars 1 forks source link

TypeScript #67

Open hushicai opened 5 years ago

hushicai commented 5 years ago

TypeScript体系调研报告

hushicai commented 5 years ago

浅谈 TypeScript 类型系统

hushicai commented 5 years ago

条件类型

https://artsy.github.io/blog/2018/11/21/conditional-types-in-typescript/

hushicai commented 4 years ago

distributive conditional type

Conditional types in which the checked type is a naked type parameter are called distributive conditional types.

例如:

(A | B | C) extends U ? X : Y

等价于

 (A extends U ? X : Y) | (B extends U ? X : Y) | (C extends U ? X : Y)

满足分配律。

更多内容参考 Microsoft/TypeScript#21316

hushicai commented 4 years ago

keyof any

Why does keyof any have type of string | number | symbol in typescript?

hushicai commented 4 years ago

bivarianceHack

https://stackoverflow.com/questions/52667959/what-is-the-purpose-of-bivariancehack-in-typescript-types

Microsoft/TypeScript#18654

hushicai commented 4 years ago

What are covariance and contravariance?

协变与逆变

hushicai commented 3 years ago

React Children with TypeScript