Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Conversation

sisou
Copy link
Member

@sisou sisou commented Sep 8, 2020

The type definitions were failing the Typescript compiler because of a broken inheritance type chain in the NetworkClient (Client.Network). This error was introduced (by me) in #555 which was recently released as v1.5.7. Sorry... 😞

Basically I overlooked that Client.PeerInfo extends Client.BasicAddress and thus inherits the parent's toPlain() contents, especially the plain netAddress object added in #555. However, the child then overwrote this property on the plain object with a stringified netAddress. The typing of this string was in the type definitions, clashing with the parent's definition of it being an object instead of a string.

This PR fixes this issue (also in code) by removing the stringified netAddress from Client.PeerInfo's toPlain() output, and has thus no significant effects for the library.

This PR also fixes the logic to detect if a netAddress is present, as the class property .netAddress is always defined, as it falls back to NetAddress.UNSPECIFIED. This, however, then has an .ip of null, enabling the proper check.

This PR also fixes some linter errors found when running npm run lint-types in this repo.

@sisou sisou added the types label Sep 8, 2020
@sisou sisou self-assigned this Sep 8, 2020
@codecov
Copy link

codecov bot commented Feb 9, 2021

Codecov Report

Merging #569 (9dd0d0a) into master (f8d2639) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@      Coverage Diff      @@
##   master   #569   +/-   ##
=============================
=============================

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8d2639...5301f2e. Read the comment docs.

@jeffesquivels jeffesquivels merged commit f472191 into master Feb 12, 2021
@jeffesquivels jeffesquivels deleted the soeren/types branch February 12, 2021 02:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants