ITADN

✨ Feature: Blog post on the difference between 'assertion' and 'cast'

#144OpenJoshuaKGoldberg 创建于 2024-12-07
type: featureaccepting prs
J
JoshuaKGoldbergcommented
### Feature Request Checklist - [X] I have [searched for related issues](https://github.com/LearningTypeScript/site/issues?q=is%3Aissue+label%3A%22type%3A+feature%22) and found none that matched my issue. - [X] This is the appropriate issue form for the feature I would like to request. ### Feature I mention in the book that common use of the two terms are different: * **Assertion** commonly means a type-system only operation: we're _"asserting"_ that, regardless of inference, a value is a particular type * **Cast8* commonly means a runtime change: we're casting/coercing a value at runtime to a different value This gets confused a lot. IMO it'd be helpful to have an article. ### Additional Info Inspired by @kirkwaiblinger's https://github.com/typescript-eslint/typescript-eslint/issues/10458, thank you Kirk! 😄 💖
0 条评论