@types/cache-manager
Stub TypeScript definitions entry for cache-manager, which provides its own types definitions
This package has a good security score with no known vulnerabilities.
Community Reviews
Simple stub package - actual types now live in cache-manager itself
In practice, you don't really interact with this package directly - you just import from 'cache-manager' and TypeScript handles everything. The types themselves (from cache-manager) are well-structured with clear interfaces for Cache, Store, and Config objects. Type inference works smoothly when setting and getting cached values, and the async/await patterns are properly typed.
One minor gotcha: if you're migrating from older versions where types were separate, you might need to clean up duplicate type declarations. The error messages when types mismatch are standard TypeScript fare - clear enough if you understand the cache-manager API, but won't hold your hand through learning it.
Best for: Projects using cache-manager that need TypeScript support - just install and forget about it.
Avoid if: You're on very old cache-manager versions (pre-v4) that haven't migrated to bundled types yet.
Stub package pointing to native types - mostly transparent but can confuse
The actual developer experience depends entirely on cache-manager's own type definitions. When they're present and correct, everything works seamlessly and you get good autocomplete for methods like set(), get(), wrap(), and store configuration. However, the redirect approach can cause confusion during setup - newcomers often install both packages unnecessarily, and dependency conflicts can arise if versions are mismatched.
The main pain point is documentation clarity. There's no clear explanation in npm or typical install flows that this is just a pointer package. You might spend time troubleshooting type issues thinking @types/cache-manager is the source, when actually you need to check cache-manager's bundled definitions.
Best for: Existing projects upgrading from cache-manager v4 to v5+ that need backward compatibility for their dependency declarations.
Avoid if: You're starting a new project - just install cache-manager directly which includes its own TypeScript definitions.
A stub package that redirects to well-typed cache-manager - seamless experience
In practice, the actual cache-manager types are well-structured with clear interfaces for Cache, CacheStore, and configuration options. Type inference works reliably when setting and getting cached values, and the generic types allow proper typing of your cached data. Error messages are helpful when you misuse the API, like forgetting to await async operations or passing incorrect store configurations.
The main gotcha is understanding the version compatibility - cache-manager v4 and earlier need the separate @types package, while v5+ has built-in types. The migration path between these versions can be confusing initially, but once you understand the versioning, it's smooth sailing. Day-to-day usage with proper types makes caching operations predictable and reduces runtime errors significantly.
Best for: Legacy projects still on cache-manager v4 or earlier that need TypeScript support.
Avoid if: You're using cache-manager v5+ where types are already included in the main package.
Sign in to write a review
Sign In