danvk / effective-typescript

Effective TypeScript 2nd Edition: 83 Specific Ways to Improve Your TypeScript

Home Page:https://effectivetypescript.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Item 41: Understand Evolving any

danvk opened this issue · comments

Comment by disqus_0l6QhEp9JS on 2020-11-28 03:11:

"A final case that triggers this "evolving any" behavior is if a variable is initially null. This often comes up when you set a value in a try/catch block:" This seems out of place - it's in the middle of a different case - and it's obviously missing at least an example piece of code, if not more...

"This behavior can be confusing to follow in your editor since the type is only "evolved" after you assign or push an element. Inspecting the type on the line with the assignment will still show any or any[]." Shouldn't this paragraph be somewhere else as well?

Asking because I'm interested in the missing example :)

Comment by disqus_0l6QhEp9JS on 2020-11-29 07:02:

No problem! Looking forward to reading the book now :)

Comment by danvdk on 2020-11-28 10:02:

Gah, should be fixed now, thanks for the heads up. (This broke along with a few other things as a result of incorporating literate-ts into the blog.)