What is the difference between never and void in typescript?

前端 未结 8 2375
刺人心
刺人心 2020-12-15 15:04

I have read this, but it is unclear what would be the difference between \'never\' and \'void\' type?

8条回答
  •  天命终不由人
    2020-12-15 15:33

    Also, for more a theorical reason, with --strictNullChecks new flag, TypeScript needed a new bottom type (since null and undefined are no more). The type never is such a bottom type and make TypeScript's type system more consistent.

提交回复
热议问题