Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Short comment about the 'unknown' type: TypeScript 4.4 had me learning about it very recently, because 'unknown' has been made the default type in 'catch (error)' clauses [0]. So most of our code in 'catch' blocks suddenly didn't compile any more after an unsuspecting update of the TS version.

Which is a good thing, because in reviewing those I found several places where incorrect assumptions were being made about the type of error that would be caught.

(side note: TypeScript does not follow SemVer; they just promise to avoid breaking changes in Patch updates, but don't promise anything won't break in Minor updates [1])

[0]: https://devblogs.microsoft.com/typescript/announcing-typescr...

[1]: https://github.com/microsoft/TypeScript/issues/14116#issueco...



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: