为什么 void & {} 不会被推断为从不在 TypeScript 中输入?

问题描述 投票:0回答:0

当我将 TypeScript 的 void 类型与其他使用交集的类型结合使用时,我得到了不同的结果。

type A = void & {} // A is void & {}
type B = void & '1' // B is never
type C = void & 1 // C is never
type D = void & string // D is never
type E = void & String // E is void & String
type A = void & {} 
type E = void & String

他们也应该永远不是类型,对吧?

javascript typescript typescript-typings
© www.soinside.com 2019 - 2024. All rights reserved.