Skip to content

update typescript definitions and the export syntax in javascript #74

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

Merged
merged 2 commits into from
Oct 18, 2018

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
@@ -87,7 +85,7 @@ declare class Long {
static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;

/**
* 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
@@ -404,3 +402,5 @@ declare class Long {
*/
xor(other: Long | number | string): Long;
}

export { Long };
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy