Registry / database / redis-typescript

redis-typescript

JSON →
library0.1.2jsnpmunverified

Tedis is a TypeScript-based Redis client for Node.js, supporting async/await with full TypeScript definitions. Version 0.1.2 (latest) offers both ESM and CJS support with a promise-based API. It provides a connection pool (TedisPool) and direct commands via Tedis.command(). Compared to ioredis, it is simpler and more lightweight, but lacks cluster support and advanced features. Development appears to be in early stages with low release cadence.

npm install redis-typescript
INSTALL
IMPORT
SIG · REDIS-TYPESCRIPT
R
redis-typescript
databasejavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tedis
import { Tedis } from 'tedis'
const Tedis = require('tedis').Tedis
ESM import is the preferred pattern; CJS also exports Tedis as a named export.
TedisPool
import { TedisPool } from 'tedis'
import TedisPool from 'tedis'
TedisPool is a named export, not a default export.
Tedis (type usage)
import { Tedis } from 'tedis'
Use the import type for TypeScript type annotations: import type { Tedis } from 'tedis'.

Creates a single connection and a connection pool, performs SET/GET commands, then gracefully closes connections.

import { Tedis, TedisPool } from 'tedis'; import { promisify } from 'util'; async function main() { // Single connection with password const tedis = new Tedis({ port: 6379, host: '127.0.0.1', password: process.env.REDIS_PASSWORD ?? '' }); await tedis.set('foo', 'bar'); const value = await tedis.get('foo'); console.log(value); // 'bar' // Connection pool example const pool = new TedisPool({ port: 6379, host: '127.0.0.1' }); const conn = await pool.getTedis(); await conn.set('pool', 'test'); console.log(await conn.get('pool')); pool.putTedis(conn); await tedis.close(); await pool.drain(); } main().catch(console.error);
Debug
Known issues
breakingCommand method 'command' expects array of arguments, but some users mistakenly pass a single argument or string.
fix
Use `await tedis.command('SET', 'key', 'value')` or `await tedis.set('key', 'value')` for string commands.
affects: >=0.0.1
deprecatedThe `Tedis` constructor accepts `password` but the property should be `auth_pass`? Check documentation.
fix
Always use `password` field in options; `auth_pass` is not supported.
affects: >=0.1.0
gotchaMissing error handling when Redis server is not running: 'ECONNREFUSED' error is thrown as unhandled promise.
fix
Wrap connection code in try-catch or use .catch() on the promise.
affects: >=0.0.1
gotchaTedisPool.putTedis() must be called after using a connection, otherwise connections are leaked.
fix
Always call pool.putTedis(conn) in a finally block or use a wrapper.
affects: >=0.0.1
gotchaThe `command` method returns raw Redis response; for hashes, hgetall returns an object with string values even if original values are numbers.
fix
Parse numbers manually or use simple get/set for numbers.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: tedis.command is not a function
Imported Tedis incorrectly (e.g., import Tedis from 'tedis' instead of import { Tedis } from 'tedis').
fix
Use named import: import { Tedis } from 'tedis'
Error: Redis connection refused (ECONNREFUSED)
Redis server not running or host/port incorrect.
fix
Start Redis server or check host/port configuration.
TypeError: tedis.set is not a function
Using Tedis after connection closed or not properly instantiated.
fix
Ensure Tedis instance is created correctly and connection is open before calling methods.
Error: NOAUTH Authentication required
Redis server requires password but not provided or incorrect password.
fix
Pass password in constructor options: new Tedis({ password: 'your_pass' })
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
redis-typescript — npm install redis-typescript · libregistry