is-kit Reached 100 Stars – What Changed Since 50
说明与用途
is-kit 达到 100 星:新增属性细化 API、扩展的离散联合验证器、更严格的语义以及更广泛的环境支持。该库现在已被其他 OSS 项目使用,并帮助发现 Effect TS 的类型推断错误。
问题
Developers need reusable runtime type guards that integrate smoothly with TypeScript control flow and can be composed across projects.
结果
The library evolved to support property refinement, exhaustive discriminated unions, stricter semantics, and broader environment compatibility. It is now adopted in multiple OSS projects and helped uncover a subtle TypeScript inference bug in Effect TS.
工作流
- 1. Identify a need for property‑level refinement of existing type guards.
- 2. Implement
refineKey,refineDefinedKey, andrefineIndexto lift a guard onto a property or array index. - 3. Add
discriminatedUnionto generate exhaustive validators for union types, checking for missing or extra branches. - 4. Tighten existing APIs (e.g.,
recordOf,struct) for stricter runtime checks and better error handling. - 5. Expand test coverage to ESM, CommonJS, Deno, and JSR environments.
- 6. Integrate is-kit into other OSS projects (e.g., changelog-bot) using
definefor reusable predicates. - 7. Resolve a real‑world bug where is-kit’s
unknownrefinement caused type inference issues in Effect TS, leading to a PR that introducedNoInfer. - 8. Document changes and share lessons learned in a blog post.
证据
"The library gained new APIs, some existing APIs became stricter, I started using it in more of my own OSS projects, and one real‑world use case even exposed a type inference edge case in Effect."
"is-kit added three property refinement helpers: refineKey, refineDefinedKey, refineIndex."
"The biggest addition since the 50-star article is probably the exhaustive discriminated union API introduced in v1.15.0."
"Recent releases included fixes around: recordOf literal-key narrowing, native Error brand checks, array guards with overridden iterators, exact struct validation, symbol-keyed struct schemas, cross-realm struct schemas."
"I started using is-kit more naturally in other OSS projects I maintain. For example, in my changelog tooling of changelog-bot, I use define to keep small predicates reusable and composable."
"An is-kit guard ran into an Effect type bug. The refinement could affect generic inference in an unexpected way. The reported case resulted in this Effect PR."
- 记录日期: 2026-10-25T12:26:25.423Z