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

Bump typescript from ~5.0.4 to ~5.1.6 #4576

Merged
merged 4 commits into from
Aug 2, 2024
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"simple-git-hooks": "^2.8.0",
"ts-node": "^10.9.1",
"tsup": "^8.0.2",
"typescript": "~5.0.4",
"typescript": "~5.1.6",
"yargs": "^17.7.2"
},
"packageManager": "yarn@4.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/accounts-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/keyring-controller": "^17.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/address-book-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/announcement-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/approval-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/accounts-controller": "^18.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/base-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/build-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/composable-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/controller-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/ens-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/network-controller": "^20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/eth-json-rpc-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"jest-it-up": "^2.0.2",
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/gas-fee-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/network-controller": "^20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/json-rpc-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"jest-it-up": "^2.0.2",
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/json-rpc-middleware-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4",
"typescript": "~5.1.6",
"webextension-polyfill-ts": "^0.26.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/keyring-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4",
"typescript": "~5.1.6",
"uuid": "^8.3.2"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/logging-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/message-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/name-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/network-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/notification-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/notification-services-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/keyring-controller": "^17.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/permission-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/approval-controller": "^7.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/permission-log-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/phishing-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
2 changes: 1 addition & 1 deletion packages/polling-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/network-controller": "^20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/preferences-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/keyring-controller": "^17.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/profile-sync-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/keyring-controller": "^17.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/queued-request-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/network-controller": "^20.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/rate-limit-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "^18.18 || >=20"
Expand Down
8 changes: 4 additions & 4 deletions packages/rate-limit-controller/src/RateLimitController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ export class RateLimitController<
}
this.recordRequest(type, origin);

const implementation = this.implementations[type].method;
const implementation = this.implementations[type].method as (
...args: Parameters<RateLimitedApis[ApiType]['method']>
) => ReturnType<RateLimitedApis[ApiType]['method']>;

if (!implementation) {
throw new Error('Invalid api type');
}

return implementation(...args) as ReturnType<
RateLimitedApis[ApiType]['method']
>;
return implementation(...args);
Comment on lines +167 to +175
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MetaMask/snaps-devs This change fixes the following regression:

ERROR: src/RateLimitController.ts:173:27 - error TS2345: Argument of type 'Parameters<RateLimitedApis[ApiType]["method"]>' is not assignable to parameter of type 'never'.
  Type 'unknown[]' is not assignable to type 'never'.
    Type 'Parameters<RateLimitedApis[keyof RateLimitedApis]["method"]>' is not assignable to type 'never'.
      Type 'unknown[]' is not assignable to type 'never'.
        Type 'Parameters<RateLimitedApis[string | number | symbol]["method"]>' is not assignable to type 'never'.
          Type 'unknown[]' is not assignable to type 'never'.
            Type 'Parameters<RateLimitedApis[string]["method"]> | Parameters<RateLimitedApis[number]["method"]> | Parameters<RateLimitedApis[symbol]["method"]>' is not assignable to type 'never'.
              Type 'Parameters<RateLimitedApis[string]["method"]>' is not assignable to type 'never'.
                Type 'unknown[]' is not assignable to type 'never'.
                  Type 'never[]' is not assignable to type 'never'.

173     return implementation(...args) as ReturnType<

Both before and after the change, the as assertion narrows the type of implementation, which is currently typed to the universal supertype (i.e. type constraint) of all RateLimitedApi method types (i.e. ActionConstraint) because there's no ApiType information to narrow it.

The only difference is that the type assertion now narrows the parameters (...args) of implementation, in addition to its return type.

}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/selected-network-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/network-controller": "^20.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/signature-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/approval-controller": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/transaction-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@babel/runtime": "^7.23.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/user-operation-controller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@metamask/approval-controller": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-package/package-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.0.4"
"typescript": "~5.1.6"
},
"engines": {
"node": "NODE_VERSIONS"
Expand Down
Loading
Loading