ts类型小寄巧

21 阅读1分钟
type T = 'a' | 'b' | string

众所周知 这样的类型定义是没有提示的 T的类型直接合并为了string
但是 这样就有类型提示了

type T = 'a' | 'b' | (string & {})

image.png