10000 Fix typings for isChildClass by jacogr · Pull Request #1824 · polkadot-js/common · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix typings for isChildClass #1824

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
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## 12.1.2 May 1, 2023

Changes:

- Adjust typing for `isChildClass` & `Constructor` usage


## 12.1.1 Apr 29, 2023

Changes:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"versions": {
"git": "12.1.2-0-x",
"npm": "12.1.1"
Expand All @@ -37,8 +37,8 @@
"test:one": "polkadot-dev-run-test --env browser"
},
"devDependencies": {
"@polkadot/dev": "^0.73.6",
"@types/node": "^18.16.2"
"@polkadot/dev": "^0.73.8",
"@types/node": "^18.16.3"
},
"resolutions": {
"typescript": "^5.0.4"
Expand Down
4 changes: 2 additions & 2 deletions packages/hw-ledger-transports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@ledgerhq/hw-transport": "^6.28.2",
"@ledgerhq/hw-transport-webhid": "^6.27.13",
"@ledgerhq/hw-transport-webusb": "^6.27.13",
"@polkadot/util": "12.1.2-0-x",
"@polkadot/util": "12.1.2",
"tslib": "^2.5.0"
},
"optionalDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/hw-ledger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"main": "index.js",
"dependencies": {
"@polkadot/hw-ledger-transports": "12.1.2-0-x",
"@polkadot/util": "12.1.2-0-x",
"@polkadot/hw-ledger-transports": "12.1.2",
"@polkadot/util": "12.1.2",
"@zondax/ledger-substrate": "^0.40.7",
"tslib": "^2.5.0"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/keyring/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"main": "index.js",
"dependencies": {
"@polkadot/util": "12.1.2-0-x",
"@polkadot/util-crypto": "12.1.2-0-x",
"@polkadot/util": "12.1.2",
"@polkadot/util-crypto": "12.1.2",
"tslib": "^2.5.0"
},
"peerDependencies": {
"@polkadot/util": "12.1.2-0-x",
"@polkadot/util-crypto": "12.1.2-0-x"
"@polkadot/util": "12.1.2",
"@polkadot/util-crypto": "12.1.2"
}
}
6 changes: 3 additions & 3 deletions packages/networks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"main": "index.js",
"dependencies": {
"@polkadot/util": "12.1.2-0-x",
"@polkadot/util": "12.1.2",
"@substrate/ss58-registry": "^1.40.0",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/hw-ledger": "12.1.2-0-x"
"@polkadot/hw-ledger": "12.1.2"
}
}
12 changes: 6 additions & 6 deletions packages/util-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"browser": {
"crypto": false,
"stream": false
Expand All @@ -29,16 +29,16 @@
"dependencies": {
"@noble/curves": "1.0.0",
"@noble/hashes": "1.3.0",
"@polkadot/networks": "12.1.2-0-x",
"@polkadot/util": "12.1.2-0-x",
"@polkadot/networks": "12.1.2",
"@polkadot/util": "12.1.2",
"@polkadot/wasm-crypto": "^7.1.2",
"@polkadot/wasm-util": "^7.1.2",
"@polkadot/x-bigint": "12.1.2-0-x",
"@polkadot/x-randomvalues": "12.1.2-0-x",
"@polkadot/x-bigint": "12.1.2",
"@polkadot/x-randomvalues": "12.1.2",
"@scure/base": "1.1.1",
"tslib": "^2.5.0"
},
"peerDependencies": {
"@polkadot/util": "12.1.2-0-x"
"@polkadot/util": "12.1.2"
}
}
12 changes: 6 additions & 6 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"main": "index.js",
"exports": {
"./hex/toU8a": {
Expand All @@ -35,15 +35,15 @@
}
},
"dependencies": {
"@polkadot/x-bigint": "12.1.2-0-x",
"@polkadot/x-global": "12.1.2-0-x",
"@polkadot/x-textdecoder": "12.1.2-0-x",
"@polkadot/x-textencoder": "12.1.2-0-x",
"@polkadot/x-bigint": "12.1.2",
"@polkadot/x-global": "12.1.2",
"@polkadot/x-textdecoder": "12.1.2",
"@polkadot/x-textencoder": "12.1.2",
"@types/bn.js": "^5.1.1",
"bn.js": "^5.2.1",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/x-randomvalues": "12.1.2-0-x"
"@polkadot/x-randomvalues": "12.1.2"
}
}
2 changes: 1 addition & 1 deletion packages/util/src/is/childClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { isClass } from './class.js';
* console.log('isChildClass', isChildClass(BN, Uint8Array); // => false
* ```
*/
export function isChildClass <P extends Constructor> (Parent: P, Child?: Constructor | null | unknown): Child is P {
export function isChildClass <P extends Constructor> (Parent: P, Child?: unknown): Child is P {
// https://stackoverflow.com/questions/30993434/check-if-a-constructor-inherits-another-in-es6/30993664
return isClass(Child) && isClass(Parent)
// eslint-disable-next-line no-prototype-builtins
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/is/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import { isOnFunction } from './helpers.js';

/**
* @name isClass
* Tests if the supplied agrument is a Class
* Tests if the supplied argument is a Class
*/
export const isClass: <T extends Constructor> (value?: unknown) => value is T = /*#__PURE__*/ isOnFunction('isPrototypeOf', 'hasOwnProperty');
3 changes: 2 additions & 1 deletion packages/util/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import type { BN } from './bn/bn.js';

export interface Constructor<T extends object = object> {
prototype: T;
new (...args: never[]): T;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
new (...args: any[]): T;

hasOwnProperty (prop: string): boolean;
isPrototypeOf (other: unknown): boolean;
Expand Down
4 changes: 2 additions & 2 deletions packages/x-bigint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"./shim.cjs"
],
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"dependencies": {
"@polkadot/x-global": "12.1.2-0-x",
"@polkadot/x-global": "12.1.2",
"tslib": "^2.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/x-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"main": "index.js",
"dependencies": {
"@polkadot/util": "12.1.2-0-x",
"@polkadot/util": "12.1.2",
"buffer-es6": "^4.9.3",
"tslib": "^2.5.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/x-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "12.1.2-0-x",
"@polkadot/x-global": "12.1.2",
"node-fetch": "^3.3.1",
"tslib": "^2.5.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/x-global/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"main": "index.js",
"dependencies": {
"tslib": "^2.5.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/x-randomvalues/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "12.1.2-0-x",
"@polkadot/x-global": "12.1.2",
"tslib": "^2.5.0"
},
"devDependencies": {
"@polkadot/util": "12.1.2-0-x",
"@polkadot/util": "12.1.2",
"@polkadot/wasm-util": "^7.1.2",
"@types/react-native": "^0.71.6"
},
"peerDependencies": {
"@polkadot/util": "12.1.2-0-x",
"@polkadot/util": "12.1.2",
"@polkadot/wasm-util": "*"
}
}
4 changes: 2 additions & 2 deletions packages/x-textdecoder/package.json
F438
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "12.1.2-0-x",
"@polkadot/x-global": "12.1.2",
"tslib": "^2.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/x-textencoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "12.1.2-0-x",
"@polkadot/x-global": "12.1.2",
"tslib": "^2.5.0"
}
}
4 changes: 2 additions & 2 deletions packages/x-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"sideEffects": false,
"type": "module",
"version": "12.1.2-0-x",
"version": "12.1.2",
"browser": "browser.js",
"main": "node.js",
"react-native": "react-native.js",
"dependencies": {
"@polkadot/x-global": "12.1.2-0-x",
"@polkadot/x-global": "12.1.2",
"tslib": "^2.5.0",
"ws": "^8.13.0"
},
Expand Down
Loading
0