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

TypeScript definition errors #369

prefixaut opened this issue Dec 1, 2019 · 2 comments


Copy link

@prefixaut prefixaut commented Dec 1, 2019

Describe the bug
I started to integrate zeromq 6.0.0-beta.5 in my TypeScript/Electron Project, I get these errors when it tries to compile it:

ERROR in D:/workspace/splitterino/node_modules/zeromq/lib/index.d.ts
216:31 Generic type 'AsyncIterator<T>' requires 1 type argument(s).
    214 |      * ```
    215 |      */
  > 216 |     [Symbol.asyncIterator](): AsyncIterator<ReceiveType<this>, undefined>;
        |                               ^
    217 | }
    218 | /**
    219 |  * Represents the options that can be assigned in the constructor of a given
ERROR in D:/workspace/splitterino/node_modules/zeromq/lib/index.d.ts
756:35 Generic type 'AsyncIterator<T>' requires 1 type argument(s).
    754 |          * ```
    755 |          */
  > 756 |         [Symbol.asyncIterator](): AsyncIterator<ReceiveType<this>, undefined>;
        |                                   ^
    757 |     }
    758 | }
    759 | /**
ERROR in D:/workspace/splitterino/node_modules/zeromq/lib/index.d.ts
1209:9 An accessor cannot be declared in an ambient context.
    1207 |      *    duplicates) are visible to the caller.
    1208 |      */
  > 1209 |     set verbosity(value: null | "allSubs" | "allSubsUnsubs");
         |         ^
    1210 |     constructor(options?: SocketOptions<XPublisher>);
    1211 | }
    1212 | export interface XPublisher extends Readable, Writable {

To me it seems like the definition file got somehow screwed up.

I can reproduce it in my Project for now.
Building the Application with github-actions on ubuntu-latest, windows-latest, and macOS-latest as well as locally are also giving me the described errors.

As nobody has yet submitted this issue apparently, it might as well be an issue with my Project.
Just wanted to have this noted.

Expected behavior
TypeScript should not throw the described compilation errors.

Tested on

  • OS: Windows 10
  • ZeroMQ.js version: 6.0.0-beta.5
@prefixaut prefixaut added the bug label Dec 1, 2019
@prefixaut prefixaut changed the title TypeScript definition errorrs TypeScript definition errors Dec 1, 2019

This comment has been minimized.

Copy link

@rolftimmermans rolftimmermans commented Dec 2, 2019

The definition of AsyncIterator has changed in TypeScript 3.6, which we use as a basis. So at the moment you'll need at least TS 3.6 to use the bindings.

I'm not sure if it's possible to define it in such a way that the definition is correct & usable for earlier versions too. PR would be welcome.

For now I've updated the README to state that you need version 3.6 or higher. Hope this helps!


This comment has been minimized.

Copy link

@prefixaut prefixaut commented Dec 2, 2019

Ah alright, yes this resolved the issue!
Thanks a lot :)

@prefixaut prefixaut closed this Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.