What is the difference between never and void in typescript?

前端 未结 8 2370
刺人心
刺人心 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:48

    The return type of Promise.reject() is Promise, meaning "it is never resolved".

    So if a function returns Promise, I think it will return only errors. On the other hand, Promise might be resolved without value.

提交回复
热议问题