Why can't void and {} be inferred as never type in TypeScript?
P粉548512637
P粉548512637 2023-09-04 16:03:52
0
1
465
<p>I get different results when I use TypeScript's void type with other types using cross types. </p> <pre class="brush:php;toolbar:false;">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</pre> <pre class="brush:php;toolbar:false;">type A = void & {} type E = void & String</pre> <p>They should also be of type never, right? </p>
P粉548512637
P粉548512637

reply all(1)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!