Skip to content

Commit

Permalink
Merge pull request #9056 from Agoric/typescript-5.4
Browse files Browse the repository at this point in the history
Typescript 5.4
  • Loading branch information
mergify[bot] authored Mar 11, 2024
2 parents c731c8c + a033f26 commit 83b106a
Show file tree
Hide file tree
Showing 15 changed files with 156 additions and 105 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"prettier": "^3.0.3",
"prettier-plugin-jsdoc": "^1.0.0",
"type-coverage": "^2.27.1",
"typedoc": "^0.25.7",
"typescript": "^5.3.3"
"typedoc": "^0.25.12",
"typescript": "^5.4.2"
},
"resolutions": {
"**/protobufjs": "^7.2.4"
Expand Down
10 changes: 5 additions & 5 deletions packages/agoric-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
"@agoric/zoe": "^0.26.2",
"@agoric/zone": "^0.2.2",
"@confio/relayer": "^0.11.3",
"@cosmjs/crypto": "^0.32.2",
"@cosmjs/encoding": "^0.32.2",
"@cosmjs/math": "^0.32.2",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/crypto": "^0.32.3",
"@cosmjs/encoding": "^0.32.3",
"@cosmjs/math": "^0.32.3",
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@endo/bundle-source": "^3.1.0",
"@endo/captp": "^4.0.4",
"@endo/compartment-mapper": "^1.1.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/casting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"@agoric/notifier": "^0.6.2",
"@agoric/spawner": "^0.6.8",
"@agoric/store": "^0.9.2",
"@cosmjs/encoding": "^0.32.2",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"@cosmjs/encoding": "^0.32.3",
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@cosmjs/tendermint-rpc": "^0.32.3",
"@endo/far": "^1.0.4",
"@endo/init": "^1.0.4",
"@endo/lockdown": "^1.0.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
"publish-scripts": "0.1.0",
"rimraf": "^5.0.0",
"tsimp": "^2.0.11",
"typescript": "^5.3.3"
"typescript": "^5.4.2"
},
"dependencies": {
"@cosmjs/amino": "^0.32.2",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"@cosmjs/amino": "^0.32.3",
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@cosmjs/tendermint-rpc": "^0.32.3",
"@endo/init": "^1.0.3",
"axios": "^1.6.7"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/pegasus/src/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import '@agoric/zoe/exported.js';
import '../exported.js';

/**
* @type {ContractStartFn<Pegasus, never, {}, {
* @type {ContractStartFn<import('./pegasus.js').Pegasus, never, {}, {
* board: ERef<BoardDepositFacet>,
* namesByAddress: ERef<import('@agoric/vats').NameHub>
* }}
* }>}
*/
export const start = (zcf, privateArgs, baggage) => {
const zone = makeDurableZone(baggage);
Expand Down
1 change: 1 addition & 0 deletions packages/pegasus/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"checkJs": false,
"maxNodeModuleJsDepth": 2,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/solo/src/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ const start = async (basedir, argv) => {

// Start timer here!
startTimer(800);
resetOutdatedState();
await resetOutdatedState();

// Remove wallet traces.
await unlink('html/wallet').catch(_ => {});
Expand Down
4 changes: 2 additions & 2 deletions packages/swing-store/src/swingStore.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
/* global Buffer */
import fs from 'fs';
import path from 'path';
import * as fs from 'fs';
import * as path from 'path';

import sqlite3 from 'better-sqlite3';

Expand Down
2 changes: 1 addition & 1 deletion packages/vats/src/core/types-ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ type StartUpgradableOpts<
import('@agoric/zoe/src/zoeService/utils').StartParams<SF>['terms'],
'brands' | 'issuers'
>;
privateArgs?: import('@agoric/zoe/src/zoeService/utils').StartParams<SF>['privateArgs'];
privateArgs?: Parameters<SF>[1];
label: string;
};

Expand Down
2 changes: 2 additions & 0 deletions packages/wallet/api/src/lib-wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -1408,11 +1408,13 @@ export function makeWalletRoot({
boardId,
dappOrigin = undefined,
) {
/** @type {Petname} */
let petname;
if (dappOrigin === undefined) {
petname = suggestedPetname;
} else {
const edgename = edgeMapping.valToPetname.get(dappOrigin);
// @ts-expect-error if suggestedPetname is itself an array, this nests
petname = [edgename, suggestedPetname];
}

Expand Down
6 changes: 3 additions & 3 deletions packages/zoe/src/contractFacet/types-ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ type ContractStartFn<
> = (
zcf: ZCF<CT>,
privateArgs: PA,
baggage?: MapStore<any, any> | undefined,
baggage: import('@agoric/vat-data').Baggage,
) => ContractStartFnResult<PF, CF>;
type ContractStartFnResult<PF, CF> = {
publicFacet: PF;
creatorFacet: CF;
publicFacet?: PF;
creatorFacet?: CF;
creatorInvitation?: Promise<Invitation<R, A>> | undefined;
};
type ContractOf<S> = import('../zoeService/utils').ContractOf<S>;
Expand Down
1 change: 0 additions & 1 deletion packages/zoe/test/privateArgsUsageContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const start = (_zcf, privateArgs) => {
const creatorFacet = Far('creatorFacet', {
usePrivateArgs: () => E(privateArgs.myArg).doTest(),
});
// @ts-expect-error missing publicFacet for ContractStartFn
return harden({ creatorFacet });
};
harden(start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const start = zcf => {

const creatorInvitation = makeSafeInvitation();

// @ts-expect-error missing creatorFacet of ContractStartFn
return harden({ creatorInvitation, publicFacet });
};

Expand Down
45 changes: 45 additions & 0 deletions patches/@endo+nat+5.0.4.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/node_modules/@endo/nat/src/index.d.ts b/node_modules/@endo/nat/src/index.d.ts
new file mode 100644
index 0000000..20bc78c
--- /dev/null
+++ b/node_modules/@endo/nat/src/index.d.ts
@@ -0,0 +1,30 @@
+/**
+ * Is `allegedNum` a number in the [contiguous range of exactly and
+ * unambiguously
+ * representable](https://esdiscuss.org/topic/more-numeric-constants-please-especially-epsilon#content-14)
+ * natural numbers (non-negative integers)?
+ *
+ * To qualify `allegedNum` must either be a
+ * non-negative `bigint`, or a non-negative `number` representing an integer
+ * within range of [integers safely representable in
+ * floating point](https://tc39.es/ecma262/#sec-number.issafeinteger).
+ *
+ * @param {unknown} allegedNum
+ * @returns {boolean}
+ */
+export function isNat(allegedNum: unknown): boolean;
+/**
+ * If `allegedNumber` passes the `isNat` test, then return it as a bigint.
+ * Otherwise throw an appropriate error.
+ *
+ * If `allegedNum` is neither a bigint nor a number, `Nat` throws a `TypeError`.
+ * Otherwise, if it is not a [safely
+ * representable](https://esdiscuss.org/topic/more-numeric-constants-please-especially-epsilon#content-14)
+ * non-negative integer, `Nat` throws a `RangeError`.
+ * Otherwise, it is converted to a bigint if necessary and returned.
+ *
+ * @param {unknown} allegedNum
+ * @returns {bigint}
+ */
+export function Nat(allegedNum: unknown): bigint;
+//# sourceMappingURL=index.d.ts.map
\ No newline at end of file
diff --git a/node_modules/@endo/nat/src/index.d.ts.map b/node_modules/@endo/nat/src/index.d.ts.map
new file mode 100644
index 0000000..a663f87
--- /dev/null
+++ b/node_modules/@endo/nat/src/index.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;GAaG;AACH,kCAHW,OAAO,GACL,OAAO,CAWnB;AAED;;;;;;;;;;;;GAYG;AACH,gCAHW,OAAO,GACL,MAAM,CAuBlB"}
\ No newline at end of file
Loading

0 comments on commit 83b106a

Please sign in to comment.