Skip to content
Docs
Changelog

No non-null assertions in the API and the native app

typescript/no-non-null-assertion is now an error in packages/api/src and apps/mobile/src outside tests. The 56 existing assertions were replaced by narrowing or by types that carry the guarantee.

Markdown

  • value! is a lint error in packages/api/src and apps/mobile/src. A non-null assertion tells the compiler that a value exists and checks nothing, so a missing value fails later as a TypeError far from its cause. Tests are exempt. Rule, reason and the ways to narrow instead: backend conventions. (#236)
  • The 56 assertions outside tests are gone, without a cast. The feedback image sniffer reads header fields through a DataView; the billing webhook handlers get their provider's settings already narrowed from the shared receive step; the Stripe subscription schema types its items as a non-empty tuple; and firstRow(rows) in packages/api/src/platform/db/first-row.ts returns the row of a statement that always returns one (INSERT … RETURNING, an aggregate) or throws. A new service uses the same helper instead of row!. (#236)
Edit on GitHubDocumentation is in English.
Cookie settings
We use essential cookies to make our app work. With your consent, we also use optional cookies to improve your experience.

Read our Cookie Policy and Privacy Policy.