This repository was archived by the owner on Jan 24, 2025. It is now read-only.
Fix type errors in types.d.ts definition file (and in code by extension) #569
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.PeerInfoextendsClient.BasicAddressand thus inherits the parent'stoPlain()contents, especially the plainnetAddressobject added in #555. However, the child then overwrote this property on the plain object with a stringifiednetAddress. 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
netAddressfromClient.PeerInfo'stoPlain()output, and has thus no significant effects for the library.This PR also fixes the logic to detect if a
netAddressis present, as the class property.netAddressis always defined, as it falls back toNetAddress.UNSPECIFIED. This, however, then has an.ipofnull, enabling the proper check.This PR also fixes some linter errors found when running
npm run lint-typesin this repo.