Skip to content

Commit 4eb84da

Browse files
committed
Fix VSCode reported lint issues (#4153, #4156, #4158, #4159).
1 parent 609e2f5 commit 4eb84da

File tree

15 files changed

+26
-25
lines changed

15 files changed

+26
-25
lines changed

src.ts/_admin/test-browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const TestData = (function() {
201201
return [ String(data.length), zlib.deflateRawSync(data).toString("base64") ].join(",");
202202
}
203203

204-
let data = [ ];
204+
let data: Array<string> = [ ];
205205
data.push(`import { ethers } from "/index.js";`);
206206
data.push(`import { inflate } from "/static/tiny-inflate.js";`);
207207
data.push(`const fs = new Map();`);

src.ts/_tests/test-contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ describe("Test Typed Contract Interaction", function() {
249249
}
250250
];
251251

252-
const abi = [ ];
252+
const abi: Array<string> = [ ];
253253
for (let i = 1; i <= 32; i++) {
254254
abi.push(`function testTyped(uint${ i * 8 }) public pure returns (string memory)`);
255255
abi.push(`function testTyped(int${ i * 8 }) public pure returns (string memory)`);

src.ts/_tests/test-wallet-mnemonic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function fromHex(hex: string): string {
1818
}
1919

2020
function repeat(text: string, length: number): Array<string> {
21-
const result = [ ];
21+
const result: Array<string> = [ ];
2222
while (result.length < length) { result.push(text); }
2323
return result;
2424
}

src.ts/abi/coders/abstract-coder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class Result extends Array<any> {
182182
}
183183
if (end > this.length) { end = this.length; }
184184

185-
const result = [ ], names = [ ];
185+
const result: Array<any> = [ ], names: Array<null | string> = [ ];
186186
for (let i = start; i < end; i++) {
187187
result.push(this[i]);
188188
names.push(this.#names[i]);
@@ -195,7 +195,7 @@ export class Result extends Array<any> {
195195
* @_ignore
196196
*/
197197
filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result {
198-
const result = [ ], names = [ ];
198+
const result: Array<any> = [ ], names: Array<null | string> = [ ];
199199
for (let i = 0; i < this.length; i++) {
200200
const item = this[i];
201201
if (item instanceof Error) {

src.ts/abi/coders/array.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ export class ArrayCoder extends Coder {
171171

172172
assertArgumentCount(value.length, count, "coder array" + (this.localName? (" "+ this.localName): ""));
173173

174-
let coders = [];
174+
let coders: Array<Coder> = [ ];
175175
for (let i = 0; i < value.length; i++) { coders.push(this.coder); }
176176

177177
return pack(writer, coders, value);
@@ -190,7 +190,7 @@ export class ArrayCoder extends Coder {
190190
assert(count * WordSize <= reader.dataLength, "insufficient data length",
191191
"BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength });
192192
}
193-
let coders = [];
193+
let coders: Array<Coder> = [];
194194
for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); }
195195

196196
return unpack(reader, coders);

src.ts/abi/fragments.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ export class ParamType {
843843
comps = null;
844844
}
845845

846-
let indexed = null;
846+
let indexed: null | boolean = null;
847847
const keywords = consumeKeywords(obj, KwModifiers);
848848
if (keywords.has("indexed")) {
849849
if (!allowIndexed) { throw new Error(""); }
@@ -1079,7 +1079,7 @@ export class ErrorFragment extends NamedFragment {
10791079
});
10801080
}
10811081

1082-
const result = [ ];
1082+
const result: Array<string> = [ ];
10831083
if (format !== "sighash") { result.push("error"); }
10841084
result.push(this.name + joinParams(format, this.inputs));
10851085
return result.join(" ");
@@ -1154,7 +1154,7 @@ export class EventFragment extends NamedFragment {
11541154
});
11551155
}
11561156

1157-
const result = [ ];
1157+
const result: Array<string> = [ ];
11581158
if (format !== "sighash") { result.push("event"); }
11591159
result.push(this.name + joinParams(format, this.inputs));
11601160
if (format !== "sighash" && this.anonymous) { result.push("anonymous"); }
@@ -1465,7 +1465,7 @@ export class FunctionFragment extends NamedFragment {
14651465
});
14661466
}
14671467

1468-
const result = [];
1468+
const result: Array<string> = [];
14691469

14701470
if (format !== "sighash") { result.push("function"); }
14711471

src.ts/abi/interface.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ export class Interface {
595595

596596
// It is a bare name, look up the function (will return null if ambiguous)
597597
if (key.indexOf("(") === -1) {
598-
const matching = [ ];
598+
const matching: Array<EventFragment> = [ ];
599599
for (const [ name, fragment ] of this.#events) {
600600
if (name.split("("/* fix:) */)[0] === key) { matching.push(fragment); }
601601
}
@@ -716,7 +716,7 @@ export class Interface {
716716

717717
// It is a bare name, look up the function (will return null if ambiguous)
718718
if (key.indexOf("(") === -1) {
719-
const matching = [ ];
719+
const matching: Array<ErrorFragment> = [ ];
720720
for (const [ name, fragment ] of this.#errors) {
721721
if (name.split("("/* fix:) */)[0] === key) { matching.push(fragment); }
722722
}
@@ -1154,7 +1154,7 @@ export class Interface {
11541154
const keys: Array<null | string> = [ ];
11551155
let nonIndexedIndex = 0, indexedIndex = 0;
11561156
fragment.inputs.forEach((param, index) => {
1157-
let value = null;
1157+
let value: null | Indexed = null;
11581158
if (param.indexed) {
11591159
if (resultIndexed == null) {
11601160
value = new Indexed(null);

src.ts/contract/contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ export class BaseContract implements Addressable, EventEmitterable<ContractEvent
679679
Object.defineProperty(this, internal, { value: { } });
680680

681681
let addrPromise;
682-
let addr = null;
682+
let addr: null | string = null;
683683

684684
let deployTx: null | ContractTransactionResponse = null;
685685
if (_deployTx) {

src.ts/providers/abstract-provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,8 @@ export class AbstractProvider implements Provider {
907907
})())
908908
});
909909

910-
let maxFeePerGas = null, maxPriorityFeePerGas = null;
910+
let maxFeePerGas: null | bigint = null;
911+
let maxPriorityFeePerGas: null | bigint = null;
911912

912913
// These are the recommended EIP-1559 heuristics for fee data
913914
const block = this._wrapBlock(_block, network);

src.ts/providers/provider-fallback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ function getFuzzyMode(quorum: number, results: Array<TallyResult>): undefined |
332332
}
333333

334334
let bestWeight = 0;
335-
let bestResult = undefined;
335+
let bestResult: undefined | number = undefined;
336336

337337
for (const { weight, result } of tally.values()) {
338338
// Use this result, if this result meets quorum and has either:

0 commit comments

Comments
 (0)