Repository navigation
v0.2.2
v0.2.2 - Async GuardReason Integrity Fix
Release Date: January 19, 2026
This release addresses a critical data integrity issue where structured reasons passed to guardFail() were being lost in asynchronous guards, and normalizes all failure reasons to objects for a better developer experience.
Critical Fixes & DX Improvements
Async GuardReason Integrity & Normalization
In previous versions, reason could be a string or a GuardReason object, leading to complex TypeScript checks like typeof reason === 'object'.
v0.2.2 fixes the async loss bug and guarantees that reason is always a GuardReason object. Even simple string failures are now automatically wrapped as { code: 'ERROR', message: '...' }.
// ✅ Guaranteed object structure in v0.2.2
const { reason } = usePulse(isAdmin);
// No more "property does not exist on type string" errors!
console.log(reason?.code);
console.log(reason?.message);Critical Fixes
Async GuardReason Integrity
In previous versions, if a guard was asynchronous (returning a Promise), any structured object passed to guardFail() (e.g., { code: 'AUTH', message: '...' }) would be converted to a plain string in the Promise's catch handler.
v0.2.2 fixes this by ensuring the internal _pulseFail signal is respected in both synchronous and asynchronous evaluation paths.
// ✅ Now works perfectly in v0.2.2
const isAdmin = guard("admin-check", async () => {
const user = await fetchUser();
if (!user) {
return guardFail({
code: "AUTH",
message: "Authentication required",
});
}
return true;
});
// In your UI component:
const { reason } = usePulse(isAdmin);
console.log(reason?.code); // "AUTH" (previously would be undefined)Improvements
Cross-Package Version Synchronization
To ensure total consistency across the monorepo, all official adapters and tools have been bumped to align with Core v0.2.2.
- React (
@pulse-js/react): Now at v0.2.0, utilizing the latest Core version for stable async guard tracking. - Tools (
@pulse-js/tools): Now at v0.2.0, improved stability for structured reason inspection. - Documentation: New examples for structured error handling in guides.
📦 Package Versions
@pulse-js/core: 0.2.2@pulse-js/tools: 0.2.0@pulse-js/react: 0.2.0@pulse-js/vue: 0.1.4@pulse-js/svelte: 0.1.6