You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-03 04:01:40 +03:00
15 lines
385 B
TypeScript
15 lines
385 B
TypeScript
const symbol = Symbol('Command Options');
|
|
|
|
export type CommandOptions<T> = T & {
|
|
readonly [symbol]: true;
|
|
};
|
|
|
|
export function commandOptions<T>(options: T): CommandOptions<T> {
|
|
(options as any)[symbol] = true;
|
|
return options as CommandOptions<T>;
|
|
}
|
|
|
|
export function isCommandOptions<T>(options: any): options is CommandOptions<T> {
|
|
return options?.[symbol] === true;
|
|
}
|