AbstractBigInt extensible (also via wrapper) (#4965)
* AbstractBigInt extensible (also via wrapper) * Add missing package
This commit is contained in:
@@ -24,7 +24,8 @@
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@polkadot/util": "^9.5.1"
|
||||
"@polkadot/util": "^9.5.1",
|
||||
"@polkadot/x-bigint": "^9.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/types": "8.9.2-3",
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2017-2022 @polkadot/types-codec authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { BigInt } from '@polkadot/x-bigint';
|
||||
|
||||
// @ts-expect-error not extensible, we make it extensible here
|
||||
export abstract class AbstractBigInt extends BigInt {
|
||||
// @ts-expect-error super() not required, the self magic does that
|
||||
constructor (value: string | number | bigint | boolean) {
|
||||
const self = Object(BigInt(value)) as typeof AbstractBigInt;
|
||||
|
||||
Object.setPrototypeOf(self, AbstractBigInt.prototype);
|
||||
|
||||
return self;
|
||||
}
|
||||
}
|
||||
@@ -2257,6 +2257,7 @@ __metadata:
|
||||
"@polkadot/types-support": 8.9.2-3
|
||||
"@polkadot/util": ^9.5.1
|
||||
"@polkadot/util-crypto": ^9.5.1
|
||||
"@polkadot/x-bigint": ^9.5.1
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
@@ -2422,7 +2423,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@polkadot/x-bigint@npm:9.5.1":
|
||||
"@polkadot/x-bigint@npm:9.5.1, @polkadot/x-bigint@npm:^9.5.1":
|
||||
version: 9.5.1
|
||||
resolution: "@polkadot/x-bigint@npm:9.5.1"
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user