typesafe-storage

JSON →
library 1.0.9 ·javascript
verified Jun 7, 2026

A TypeScript-first wrapper around localStorage and sessionStorage that enforces type safety for stored values. Version 1.0.9 uses a `createStorage` function accepting a generic type map, so only defined keys and value types are allowed at compile time. Unlike raw Web Storage (which only stores strings), it automatically serializes/deserializes objects and arrays via JSON. The package has no runtime dependencies and ships its own TypeScript definitions. It follows semantic versioning and is released on demand. Key differentiators: full type inference for keys and values, no extra configuration beyond the generic parameter, and a simple API mirroring the standard Storage interface.