DEV Community

loading...

Discussion on: TypeScript Types Deep Dive - Part 3: Functions

Collapse
itsjzt profile image
Saurabh Sharma

Thanks for the great article Jaime,

One thing I would like to add is: never

Lets say we have a function that can return data or throw Error
Then function type would be () => Data | never

Doc's are little unclear about it but here are some of the use cases stackoverflow.com/questions/422918...

Collapse
vintharas profile image
Jaime 🔥🧙‍♂️🔥 Author

Thank you Saurabh! You are right! I kind of completely forgot writing about void and never. Thank you for your comment!

Collapse
itsjzt profile image
Saurabh Sharma

They are usually not that much used tho