Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested named tuple types aren't downleveled #50

Open
mmkal opened this issue Dec 5, 2020 · 0 comments
Open

Nested named tuple types aren't downleveled #50

mmkal opened this issue Dec 5, 2020 · 0 comments

Comments

@mmkal
Copy link

mmkal commented Dec 5, 2020

Repro (bash):

echo 'export type A = [one: 1, two: [three: 3, four: 4]]' > test.d.ts
npx downlevel-dts@0.7.0 test.d.ts out.d.ts
cat out.d.ts

Result:

export type A = [
    /*one*/ 1,
    /*two*/ [
        three: 3,
        four: 4
    ]
];

Expected:

export type A = [
    /*one*/ 1,
    /*two*/ [
        /*three*/ 3,
        /*four*/ 4
    ]
];

This can be worked around by running downlevel-dts multiple times, but it's hard to know how many!

mmkal added a commit to mmkal/handy-redis that referenced this issue Dec 5, 2020
mmkal added a commit to mmkal/handy-redis that referenced this issue Dec 5, 2020
mmkal added a commit to mmkal/handy-redis that referenced this issue Dec 5, 2020
* Use named tuple types

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>;
```

* downlevel in a loop, until stabilised

Workaround for sandersn/downlevel-dts#50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant