Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Conversation

@teogeb
Copy link
Contributor

@teogeb teogeb commented Mar 2, 2021

No description provided.

@teogeb teogeb requested a review from timoxley March 2, 2021 16:05
Copy link
Contributor

@timoxley timoxley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connection debug parameter should be optional but otherwise lgtm.

isWaiting?: Todo
_isReconnecting: Todo
_backoffTimeout: Todo
sendID: Todo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try removing :Todo, some of these might "just work" as of TS 4.0: https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#class-property-inference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, onReconnecting and onMessage work also ok without type definition. Marked the fields as Todo so that we'll define the actual type in the future (and the full benefit of the type system).

}

constructor(options = {}, client) {
constructor(options = {}, debug: Debug.Debugger) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note original code worked like this:
f3bae13#diff-0e149db9f5c84dd5e3126b72e3cdcf3c297e6f2836d6a1b6bf0dea41cf05760fL66-L71

        if (options.debug) {	
            this._debug = options.debug.extend(id)	
        } else {	
            this._debug = Debug(`StreamrClient::${id}`)	
        }

debug should be optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed that to an optional parameter.

In the previous PR I marked debug as a required parameter because I looked like the Connection and StreamrClient debug instances are in practice linked together (in production code Connection's debug was always derived from StreamrClient's debug). But maybe optionality better as it makes Connection more independent in theory.

@teogeb teogeb merged commit 9b2805f into 5.x Mar 3, 2021
@teogeb teogeb deleted the fix-connection-test branch March 3, 2021 11:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants