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

Upgrade to typescript v5 #4184

Merged
merged 4 commits into from
Jul 26, 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
23 changes: 23 additions & 0 deletions .github/workflows/compile-with-typescript-v4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Compile with typescript v4

on:
push:
branches: main
pull_request:
branches:
- "**"

jobs:
compile_with_typescript_v4:
name: Compile with typescript v4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: Install typescript v4 in all packages
run: |
sed -i 's/"typescript": "~5.0.0"/"typescript": "^4.0.0"/' package.json packages/*/package.json && yarn
- name: Build
run: yarn build
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@changesets/cli": "^2.16.0",
"prettier": "2.4.1",
"shelljs": "^0.8.5",
"typescript": "~4.7.4",
"typescript": "~5.0.0",
"wsrun": "^5.2.2"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-chai-matchers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"sinon": "^9.0.0",
"time-require": "^0.1.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"dependencies": {
"@ethersproject/abi": "^5.1.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import type { BigIntLike } from "@nomicfoundation/ethereumjs-util";

import {
AccessListEIP2930TxData,
TxData,
} from "@nomicfoundation/ethereumjs-tx";

import { FeeMarketEIP1559TxData } from "@nomicfoundation/ethereumjs-tx/dist/types";
import { RpcTransaction } from "../../../core/jsonrpc/types/output/transaction";

// the FeeMarketEIP1559TxData interface from ethereum js also has a
// `gasPrice?: never | null` property, which causes a compilation
// error in the latest version of typescript
interface FeeMarketEIP1559TxData extends AccessListEIP2930TxData {
maxPriorityFeePerGas?: BigIntLike;
maxFeePerGas?: BigIntLike;
}

export function rpcToTxData(
rpcTransaction: RpcTransaction
): TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData {
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-core/src/internal/util/unsafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ export const unsafeObjectKeys = Object.keys as <T>(
* This function is a typed version of `Object.entries`. Note that it's type
* unsafe. You have to be sure that `o` has exactly the same keys as `T`.
*/
export function unsafeObjectEntries<T>(o: T) {
export function unsafeObjectEntries<T extends object>(o: T) {
return Object.entries(o) as Array<[keyof T, T[keyof T]]>;
}
2 changes: 1 addition & 1 deletion packages/hardhat-ethers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"rimraf": "^3.0.2",
"sinon": "^9.0.0",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"ethers": "^6.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-foundry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"hardhat": "^2.12.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-ledger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"prettier": "2.4.1",
"ts-node": "^10.8.0",
"sinon": "^9.0.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"hardhat": "^2.16.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-network-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"hardhat": "^2.9.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-shorthand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"dependencies": {
"@fvictorio/tabtab": "^0.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-solhint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"rimraf": "^3.0.2",
"sinon": "^9.0.0",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"hardhat": "^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-solpp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"hardhat": "^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"solidity-coverage": "^0.8.1",
"ts-node": "^10.8.0",
"typechain": "^8.2.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-truffle4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4",
"typescript": "~5.0.0",
"web3": "^0.20.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-truffle5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4",
"typescript": "~5.0.0",
"web3": "^1.0.0-beta.36"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-verify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"sinon": "^9.0.0",
"sinon-chai": "^3.7.0",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"hardhat": "^2.0.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-vyper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4"
"typescript": "~5.0.0"
},
"peerDependencies": {
"hardhat": "^2.8.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-web3-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4",
"typescript": "~5.0.0",
"web3": "^0.20.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-web3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"prettier": "2.4.1",
"rimraf": "^3.0.2",
"ts-node": "^10.8.0",
"typescript": "~4.7.4",
"typescript": "~5.0.0",
"web3": "^1.0.0-beta.36"
},
"peerDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9529,10 +9529,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==

typescript@~4.7.4:
version "4.7.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235"
integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==
typescript@~5.0.0:
version "5.0.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==

typical@^4.0.0:
version "4.0.0"
Expand Down
Loading