site icon indicating copy to clipboard operation
site copied to clipboard

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

Open JoshuaKGoldberg opened this issue 1 year ago • 0 comments

Feature Request Checklist

  • [X] I have searched for related issues 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! 😄

💖

JoshuaKGoldberg avatar Dec 07 '24 16:12 JoshuaKGoldberg