Skip to content

update typescript definitions and the export syntax in javascript#74

Merged
dcodeIO merged 2 commits intodcodeIO:masterfrom
amarzavery:typings
Oct 18, 2018
Merged

update typescript definitions and the export syntax in javascript#74
dcodeIO merged 2 commits intodcodeIO:masterfrom
amarzavery:typings

Conversation

@amarzavery
Copy link
Contributor

  • updated typescript type definitions to export the Long class along with the default export
  • Added default and Long as properties on module.exports. This does not cause any breaking changes and also ensure that someone can import the packages in TypeScript as follows
  • import Long from "long";
  • import { Long } from "long";

@amarzavery
Copy link
Contributor Author

@dcodeIO Can you please review the PR? Help this get merged and publish the package as well?

@amarzavery
Copy link
Contributor Author

@MattiasBuelens - Can you please review this PR? I saw you had some comments on #66. This is not solving the problem in that PR. However this PR will ensure that the library is usable in TS land.

index.d.ts Outdated

/**
* Creates a Long from its little endian byte representation.
* Creates a Long from its big endian byte representation.
Copy link
Owner

Choose a reason for hiding this comment

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

Why has this been switched? fromBytesLE = little endian, fromBytesbE = big endian

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry wanted to update documentation for the other function. Have fixed it.

index.d.ts Outdated
xor(other: Long | number | string): Long;
}

export { Long }; No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

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

Does the type definition still support import * as Long from "long" for backwards compatibility?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope it does not. Just saw the type definition in @types/long package. If people are already using that then this will be a breaking change. Will keep the same design for backwards compatibility.

@amarzavery
Copy link
Contributor Author

@dcodeIO - Can you please review the updated changes?

@dcodeIO dcodeIO merged commit f28f1be into dcodeIO:master Oct 18, 2018
@dcodeIO
Copy link
Owner

dcodeIO commented Oct 18, 2018

Thanks, looking good. Still not sure how to proceed with #66 though :/

@amarzavery
Copy link
Contributor Author

@dcodeIO - Thanks for merging the PR. Any idea when will the new package be published to npm?

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

Successfully merging this pull request may close these issues.

2 participants