Skip to content

Commit

Permalink
Merge pull request #6582 from Agoric/ta/this-type
Browse files Browse the repository at this point in the history
types for `this` in far classes
  • Loading branch information
mergify[bot] committed Nov 18, 2022
2 parents a5437cf + 91fdd77 commit e5ed233
Show file tree
Hide file tree
Showing 43 changed files with 108 additions and 63 deletions.
1 change: 1 addition & 0 deletions packages/ERTP/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
"types": [
"node"
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"checkJs": true,
"noEmit": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
2 changes: 2 additions & 0 deletions packages/SwingSet/src/lib-nodejs/worker-protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Transform } from 'stream';
export function arrayEncoderStream() {
/**
*
* @this {{ push: (b: Buffer) => void }}
* @param {*} object
* @param {BufferEncoding} encoding
* @param {*} callback
Expand All @@ -30,6 +31,7 @@ export function arrayEncoderStream() {
export function arrayDecoderStream() {
/**
*
* @this {{ push: (b: Buffer) => void }}
* @param {Buffer} buf
* @param {BufferEncoding} encoding
* @param {*} callback
Expand Down
2 changes: 2 additions & 0 deletions packages/SwingSet/src/lib/netstring.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function encode(data) {
export function netstringEncoderStream() {
/**
*
* @this {{ push: (b: Buffer) => void }}
* @param {Buffer} chunk
* @param {BufferEncoding} encoding
* @param {*} callback
Expand Down Expand Up @@ -86,6 +87,7 @@ export function netstringDecoderStream(optMaxChunkSize) {
let buffered = Buffer.from('');
/**
*
* @this {{ push: (b: Buffer) => void }}
* @param {Buffer} chunk
* @param {BufferEncoding} encoding
* @param {*} callback
Expand Down
1 change: 1 addition & 0 deletions packages/access-token/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
3 changes: 3 additions & 0 deletions packages/agoric-cli/src/commands/oracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const makeOracleCommand = async logger => {
)
.option('--offerId [number]', 'Offer id', Number, Date.now())
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

const instance = lookupPriceAggregatorInstance(opts.pair);
Expand Down Expand Up @@ -104,6 +105,7 @@ export const makeOracleCommand = async logger => {
)
.requiredOption('--price [number]', 'price (format TODO)', String)
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

/** @type {import('../lib/psm.js').OfferSpec} */
Expand Down Expand Up @@ -136,6 +138,7 @@ export const makeOracleCommand = async logger => {
['ATOM', 'USD'],
)
.action(async function () {
// @ts-expect-error this implicit any
const { pair } = this.opts();

const capDataStr = await vstorage.readLatest(
Expand Down
1 change: 1 addition & 0 deletions packages/agoric-cli/src/commands/perf.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const makePerfCommand = async logger => {
)
.option('--home [string]', 'directory for config and data')
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();
logger.warn({ opts });
const payloadStr = await fs.readFileSync(opts.executeOffer).toString();
Expand Down
7 changes: 7 additions & 0 deletions packages/agoric-cli/src/commands/psm.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const makePsmCommand = async logger => {
['IST', 'AUSD'],
)
.action(async function () {
// @ts-expect-error this implicit any
const { pair } = this.opts();
const { governance } = await getGovernanceState(pair);
console.log('psm governance params', Object.keys(governance));
Expand Down Expand Up @@ -159,6 +160,7 @@ export const makePsmCommand = async logger => {
.option('--feePct [%]', 'Gas fee percentage', Number)
.option('--offerId [number]', 'Offer id', Number, Date.now())
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();
console.warn('running with options', opts);
const instance = await lookupPsmInstance(opts.pair);
Expand All @@ -172,6 +174,7 @@ export const makePsmCommand = async logger => {
.description('join the economic committee')
.option('--offerId [number]', 'Offer id', Number, Date.now())
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

const { economicCommittee } = agoricNames.instance;
Expand Down Expand Up @@ -202,6 +205,7 @@ export const makePsmCommand = async logger => {
.description('prepare an offer to accept the charter invitation')
.option('--offerId [number]', 'Offer id', Number, Date.now())
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

const { psmCharter } = agoricNames.instance;
Expand Down Expand Up @@ -255,6 +259,7 @@ export const makePsmCommand = async logger => {
1,
)
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

const psmInstance = lookupPsmInstance(opts.pair);
Expand Down Expand Up @@ -312,6 +317,7 @@ export const makePsmCommand = async logger => {
1,
)
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

const psmInstance = lookupPsmInstance(opts.pair);
Expand Down Expand Up @@ -366,6 +372,7 @@ export const makePsmCommand = async logger => {
Number,
)
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

const questionHandleCapDataStr = await vstorage.readLatest(
Expand Down
4 changes: 4 additions & 0 deletions packages/agoric-cli/src/commands/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const makeWalletCommand = async () => {
spend,
home,
keyringBackend: backend,
// @ts-expect-error this implicit any
} = this.opts();
const tx = `provision-one ${nickname} ${account} SMART_WALLET`;
if (spend) {
Expand Down Expand Up @@ -102,6 +103,7 @@ export const makeWalletCommand = async () => {
offer,
home,
keyringBackend: backend,
// @ts-expect-error this implicit any
} = this.opts();

execSwingsetTransaction(
Expand Down Expand Up @@ -131,6 +133,7 @@ export const makeWalletCommand = async () => {
normalizeAddress,
)
.action(async function () {
// @ts-expect-error this implicit any
const opts = this.opts();

const { agoricNames, fromBoard, vstorage } = await makeRpcUtils({
Expand Down Expand Up @@ -176,6 +179,7 @@ export const makeWalletCommand = async () => {
normalizeAddress,
)
.action(async function () {
// @ts-expect-error this implicit any
const { from } = this.opts();
const spec = `:published.wallet.${from}`;

Expand Down
4 changes: 2 additions & 2 deletions packages/assert/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"compilerOptions": {
"target": "esnext",
"module": "esnext",

"noEmit": true,
/*
/*
// The following flags are for creating .d.ts files:
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
*/
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/cache/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/casting/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-proto/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
"outDir": "dist"
},
Expand Down
1 change: 1 addition & 0 deletions packages/cosmic-swingset/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/deploy-script-support/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/deployment/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/governance/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/inter-protocol/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/internal/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"downlevelIteration": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
"types": [
"node"
Expand Down
1 change: 1 addition & 0 deletions packages/notifier/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
4 changes: 2 additions & 2 deletions packages/pegasus/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"compilerOptions": {
"target": "esnext",
"module": "esnext",

"noEmit": true,
/*
/*
// The following flags are for creating .d.ts files:
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
*/
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
1 change: 1 addition & 0 deletions packages/smart-wallet/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"noEmit": true,
"downlevelIteration": true,
"strictNullChecks": true,
"noImplicitThis": true,
"moduleResolution": "node",
},
"include": [
Expand Down
Loading

0 comments on commit e5ed233

Please sign in to comment.