Skip to content
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

Fix TypeScript typing of bigints #12

Merged
merged 1 commit into from
May 17, 2020
Merged

Fix TypeScript typing of bigints #12

merged 1 commit into from
May 17, 2020

Conversation

DASPRiD
Copy link
Contributor

@DASPRiD DASPRiD commented May 16, 2020

The typescript typehints were incorrect. They were refering to the BigInt class instead of the bigint type. This made typescript trip in this situation:

const foo = 1n;
const bar = foo - fnv1a.bigInt('foobar');

In this case, typescript compiler would complain that the minus operator does not work with bigint and BigInt. Workaround without this patch:

const bar = foo - (fnv1a.bigInt('foobar') as bigint);

@sindresorhus sindresorhus changed the title Fix typing of bigints Fix TypeScript typing of bigints May 17, 2020
@sindresorhus sindresorhus merged commit 8b1778d into sindresorhus:master May 17, 2020
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