mmkal / handy-redis

A wrapper around node_redis with Promise and TypeScript support.
Apache License 2.0
172 stars 10 forks source link

Named tuple types #254

Closed mmkal closed 3 years ago

mmkal commented 3 years ago

This applies a few improvements to how things are named, and uses the new TypeScript named tuple type feature to make complex commands which require tuple inputs more readable.

Example: Before:

xgroup(delconsumer_key_groupname_consumername?: ["DELCONSUMER", [string, string, string]]): Promise<unknown>;

After:

xgroup(
        delconsumer?: [
            delconsumer: "DELCONSUMER",
            key_groupname_consumername: [key: string, groupname: string, consumername: string]
        ]
    ): Promise<unknown>;

ts34 output:

    xgroup(delconsumer?: [
        /*delconsumer*/ "DELCONSUMER",
        /*key_groupname_consumername*/ [
            /*key*/ string,
            /*groupname*/ string,
            /*consumername*/ string
        ]
    ]): Promise<unknown>;

Also use downlevel-dts to produce types compatible with typescript <4.