Skip to content

Commit

Permalink
chore(devDep): Bump typescript from ~4.8.4 to ~5.0.4 (#2594)
Browse files Browse the repository at this point in the history
## Motivation

As part of its OKRs (Q2 2024 O3KR4, Q3 2024 O2KR4) the Wallet Framework
Team has upgraded all core packages to use TypeScript v5.0, and is
enabling other packages throughout our codebase to upgrade as well.
Unblocking the snaps monorepo is a high priority, as it has close
interdependencies with core monorepo.

This commit upgrades the TypeScript version used in the snaps monorepo
by two major versions: v4.9 and v5.0.

- https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/
- https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/

## Features

### `v4.9`
- [`satisfies`
operator](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#the-satisfies-operator)
  - See MetaMask/core#1972
- [Unlisted property narrowing with `in`
operator](https://devblogs.microsoft.com/typescript/announcing-typescript-4-9/#in-narrowing)

### `v5.0`
- [`const` Type
Parameters](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#const-type-parameters):
  - Causes `as const` inference by default.
  - 77 `as const` instances in the snaps monorepo.
```ts
type HasNames = { names: readonly string[] };
function getNamesExactly<const T extends HasNames>(arg: T): T["names"] {
//                       ^^^^^
    return arg.names;
}
// Inferred type without `const`: string[]
// Inferred type with `const`: readonly ["Alice", "Bob", "Eve"]
// Note: Didn't need to write 'as const' here
const names = getNamesExactly({ names: ["Alice", "Bob", "Eve"] });
```
- `enum` improvements:
- [All `enum`s are union
`enum`s](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#all-enums-are-union-enums)
- [`enum`
overhaul](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#enum-overhaul)
  - 30 `enum` instances in the snaps monorepo.
- Decorators

## Breaking Changes

### `v5.0`
- Full list of breaking changes and deprecations:
https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#breaking-changes-and-deprecations
- Regressions in Snaps repo
- [Forbidden Implicit Coercions in Relational
Operators](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#forbidden-implicit-coercions-in-relational-operators)
- Fixed here:
fffe4b2
  • Loading branch information
MajorLift authored Jul 23, 2024
1 parent 3ec6169 commit f7c4121
Show file tree
Hide file tree
Showing 50 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"simple-git-hooks": "^2.7.0",
"ts-node": "^10.9.1",
"tsup": "^8.0.1",
"typescript": "~4.8.4",
"typescript": "~5.0.4",
"vite": "^4.3.9"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"ts-node": "^10.9.1",
"tsc-watch": "^4.5.0",
"tsup": "^8.0.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/client-status/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/cronjobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethereum-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4",
"typescript": "~5.0.4",
"webpack": "^5.88.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/file-upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-entropy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/home-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/images/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/interactive-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/invoke-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/json-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/jsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/lifecycle-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/localization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/manage-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/name-lookup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/network-access/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/rollup-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rollup": "^2.73.0",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/signature-insights/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.2.11",
"ts-node": "^10.9.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/webpack-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"swc-loader": "^0.2.3",
"terser-webpack-plugin": "^5.3.9",
"ts-node": "^10.9.1",
"typescript": "~4.8.4",
"typescript": "~5.0.4",
"webpack": "^5.88.0",
"webpack-cli": "^5.1.4"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-browserify-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"tsup": "^8.0.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"ts-node": "^10.9.1",
"tsc-watch": "^4.5.0",
"tsup": "^8.0.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"rimraf": "^4.1.2",
"ts-node": "^10.9.1",
"tsup": "^8.0.1",
"typescript": "~4.8.4",
"typescript": "~5.0.4",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.0.5",
"wdio-chromedriver-service": "^8.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-execution-environments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"terser": "^5.17.7",
"ts-node": "^10.9.1",
"tsup": "^8.0.1",
"typescript": "~4.8.4",
"typescript": "~5.0.4",
"vite": "^4.3.9",
"vite-tsconfig-paths": "^4.0.5",
"wdio-chromedriver-service": "^8.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"tsup": "^8.0.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-rollup-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"rimraf": "^4.1.2",
"rollup": "^2.73.0",
"tsup": "^8.0.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-rpc-methods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"prettier-plugin-packagejson": "^2.2.11",
"rimraf": "^4.1.2",
"tsup": "^8.0.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"rimraf": "^4.1.2",
"ts-jest": "^29.1.1",
"tsup": "^8.0.1",
"typescript": "~4.8.4"
"typescript": "~5.0.4"
},
"engines": {
"node": "^18.16 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-simulator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"ts-node": "^10.9.1",
"tsconfig-paths-webpack-plugin": "^4.0.1",
"tsup": "^8.0.1",
"typescript": "~4.8.4",
"typescript": "~5.0.4",
"webpack": "^5.88.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
Expand Down
Loading

0 comments on commit f7c4121

Please sign in to comment.