handy-redis
Advanced tools
Comparing version 2.0.3 to 2.1.0
import * as nodeRedis from "redis"; | ||
import { Commands } from "../generated/interface"; | ||
import { Push } from "../type-util"; | ||
export declare type ResultType<K extends keyof Commands> = ReturnType<Commands[K]> extends Promise<infer X> ? X : never; | ||
import { Push } from "../push"; | ||
export declare type CommandResult<K extends keyof Commands> = ReturnType<Commands[K]> extends Promise<infer X> ? X : never; | ||
/** | ||
* types from multis depend on a bunch of type inference so in IDEs they can end up looking like: | ||
* ``` | ||
* Push<Push<Push<[], string>, "OK">, string[]> | ||
* ``` | ||
* | ||
* This makes them appear as | ||
* ``` | ||
* [string, "OK", string[]] | ||
* ``` | ||
* | ||
* Taken from https://github.com/sindresorhus/type-fest/pull/157 | ||
*/ | ||
export declare type Simplify<T> = { | ||
[K in keyof T]: T[K]; | ||
}; | ||
export declare const WrappedNodeRedisMultiImpl: { | ||
@@ -13,4 +29,5 @@ new (multi: nodeRedis.Multi): { | ||
}; | ||
export declare type MultiCommands = Exclude<keyof Commands, "exec" | "exec_atomic">; | ||
export declare type WrappedNodeRedisMulti<Results extends unknown[] = []> = { | ||
[K in Exclude<keyof Commands, "exec" | "exec_atomic">]: (...args: Parameters<Commands[K]>) => WrappedNodeRedisMulti<Push<Results, ResultType<K> | nodeRedis.ReplyError>>; | ||
[K in MultiCommands]: (...args: Parameters<Commands[K]>) => WrappedNodeRedisMulti<Push<Results, CommandResult<K> | nodeRedis.ReplyError>>; | ||
} & { | ||
@@ -17,0 +34,0 @@ exec: () => Promise<Results>; |
{ | ||
"name": "handy-redis", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "A redis client with first-class Promise and TypeScript support, and extensive documentation.", | ||
@@ -22,4 +22,12 @@ "keywords": [ | ||
"types": "dist/index.d.ts", | ||
"typesVersions": { | ||
"<=4.0": { | ||
"*": [ | ||
"ts34/*" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"ts34" | ||
], | ||
@@ -30,9 +38,9 @@ "scripts": { | ||
"build": "yarn typecheck && yarn compile", | ||
"postbuild": "sed -i 's~declare type Push_ts4~// @ts-ignore (https://github.com/mmkal/handy-redis/pulls/251)\\ndeclare type Push_ts4~g' dist/type-util.d.ts", | ||
"check-clean": "check-clean", | ||
"ci": "run-s clean build coverage lint check-clean", | ||
"preclean": "del-cli temp/backup-test-generated && mkdir -p temp && cp -r test/generated temp/backup-test-generated", | ||
"clean": "del-cli 'dist' 'src/generated' 'test/generated'", | ||
"clean": "del-cli 'dist' 'ts34' 'src/generated' 'test/generated'", | ||
"codegen": "ts-node codegen/generate-schema && ts-node codegen/generate-client && ts-node codegen/generate-tests", | ||
"compile": "tsc -p tsconfig.lib.json", | ||
"postcompile": "node downlevel", | ||
"coverage": "yarn test --coverage", | ||
@@ -55,20 +63,21 @@ "coveralls": "yarn coverage --coverageReporters=text-lcov | coveralls", | ||
"@types/cross-spawn": "6.0.2", | ||
"@types/eslint": "7.2.5", | ||
"@types/jest": "26.0.15", | ||
"@types/eslint": "7.2.6", | ||
"@types/jest": "26.0.16", | ||
"@types/lodash": "4.14.165", | ||
"@types/node": "12.12.37", | ||
"@types/redis-mock": "0.17.0", | ||
"@typescript-eslint/eslint-plugin": "4.8.2", | ||
"@typescript-eslint/parser": "4.8.2", | ||
"@typescript-eslint/eslint-plugin": "4.9.0", | ||
"@typescript-eslint/parser": "4.9.0", | ||
"check-clean": "0.3.0", | ||
"del-cli": "3.0.1", | ||
"eslint": "7.14.0", | ||
"downlevel-dts": "0.7.0", | ||
"eslint": "7.15.0", | ||
"eslint-config-xo": "0.33.1", | ||
"eslint-config-xo-typescript": "0.36.0", | ||
"eslint-plugin-codegen": "0.14.2", | ||
"eslint-plugin-codegen": "0.14.3", | ||
"eslint-plugin-import": "2.22.1", | ||
"eslint-plugin-jest": "24.1.3", | ||
"eslint-plugin-prettier": "3.1.4", | ||
"eslint-plugin-prettier": "3.2.0", | ||
"eslint-plugin-unicorn": "23.0.0", | ||
"expect-type": "0.9.2", | ||
"expect-type": "0.10.0", | ||
"jest": "26.6.3", | ||
@@ -83,3 +92,3 @@ "lodash": "4.17.20", | ||
"ts-jest": "26.4.4", | ||
"ts-node": "9.0.0", | ||
"ts-node": "9.1.0", | ||
"typescript": "4.1.2" | ||
@@ -86,0 +95,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
686971
30
14006
31