Last 12 weeks · 6 commits
4 of 6 standards met
I find myself repetitively using for applying object updates in-place, such as: This is purely untyped and will easy replace say a string field with a number value. (Moreover, it will gladly accept anything as the update, even a non-object). So, when I don't forget, I add a manual guard: I think a helper like this, named , will naturally go in this library alongside , , etc. Granted, it's a quite naive one-liner, but so are the other existing helpers.
A typical use-case is to check exhaustiveness of a switch/case block There are so many custom copies of this utility already on Github: https://github.com/search?q=assertNever+language%3ATypeScript&type=code&l=TypeScript Seems like a reasonable addition to this library. Would you accept a PR adding it?
Repository: sindresorhus/ts-extras. Description: Essential utilities for TypeScript projects Stars: 790, Forks: 25. Primary language: TypeScript. Languages: TypeScript (100%). License: MIT. Latest release: v1.2.0 (3d ago). Open PRs: 0, open issues: 0. Last activity: 3d ago. Community health: 71%. Top contributors: sindresorhus, younho9, jonahsnider, ifiokjr, Max10240, carlrosell, fregante, tychenjiajun, mehcode.