From 61d2e6c5e59fa0e9f5ae211f850c84b7886e0d76 Mon Sep 17 00:00:00 2001 From: Ian He <39037239+ianhe8x@users.noreply.github.com> Date: Wed, 13 Jan 2021 21:01:11 +1300 Subject: [PATCH] toBigInt() uses primitive type `bigint` (#3047) --- packages/types/src/codec/AbstractInt.ts | 2 +- packages/types/src/codec/Compact.ts | 2 +- packages/types/src/codec/Date.ts | 2 +- packages/types/src/types/interfaces.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/types/src/codec/AbstractInt.ts b/packages/types/src/codec/AbstractInt.ts index 049234d9b8..f2dbf565d9 100644 --- a/packages/types/src/codec/AbstractInt.ts +++ b/packages/types/src/codec/AbstractInt.ts @@ -146,7 +146,7 @@ export abstract class AbstractInt extends BN implements Codec { /** * @description Returns a BigInt representation of the number */ - public toBigInt (): BigInt { + public toBigInt (): bigint { return BigInt(this.toString()); } diff --git a/packages/types/src/codec/Compact.ts b/packages/types/src/codec/Compact.ts index 8418e60669..1f8e6d29c0 100644 --- a/packages/types/src/codec/Compact.ts +++ b/packages/types/src/codec/Compact.ts @@ -95,7 +95,7 @@ export class Compact implements ICompact { /** * @description Returns a BigInt representation of the number */ - public toBigInt (): BigInt { + public toBigInt (): bigint { return BigInt(this.toString()); } diff --git a/packages/types/src/codec/Date.ts b/packages/types/src/codec/Date.ts index 4ad7d17e47..7cc141a39f 100644 --- a/packages/types/src/codec/Date.ts +++ b/packages/types/src/codec/Date.ts @@ -83,7 +83,7 @@ export class CodecDate extends Date implements Codec { /** * @description Returns a BigInt representation of the number */ - public toBigInt (): BigInt { + public toBigInt (): bigint { return BigInt(this.toNumber()); } diff --git a/packages/types/src/types/interfaces.ts b/packages/types/src/types/interfaces.ts index b9ee6340cd..675b60c37d 100644 --- a/packages/types/src/types/interfaces.ts +++ b/packages/types/src/types/interfaces.ts @@ -8,7 +8,7 @@ import type { Hash } from '../interfaces/runtime'; import type { AnyTuple, ArgsDef, Codec } from './codec'; export interface ICompact extends Codec { - toBigInt (): BigInt; + toBigInt (): bigint; toBn (): BN; toNumber (): number; unwrap (): T;