Skip to content

Commit d93e163

Browse files
committed
refactor: enable noImplicitThis
1 parent 03bc24c commit d93e163

File tree

4 files changed

+25
-20
lines changed

4 files changed

+25
-20
lines changed

src/AeSdkMethods.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Object.assign(AeSdkMethods.prototype, mapObject<Function, Function>(
147147
methods,
148148
([name, handler]) => [
149149
name,
150-
function methodWrapper(...args: any[]) {
150+
function methodWrapper(this: AeSdkMethods, ...args: any[]) {
151151
args.length = handler.length;
152152
const options = args[args.length - 1];
153153
args[args.length - 1] = {

src/tx/builder/field-types/coin-amount.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter
55
export default {
66
...uInt,
77

8-
serializeAettos(value: string | undefined): string {
8+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9+
serializeAettos(value: string | undefined, params: {}): string {
910
return value ?? '0';
1011
},
1112

test/integration/rpc.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,27 @@ import { Accounts, Network } from '../../src/aepp-wallet-communication/rpc/types
4141

4242
const WindowPostMessageFake = (
4343
name: string,
44-
): ImplPostMessage & { name: string; messages: any[] } => ({
45-
name,
46-
messages: [],
47-
addEventListener(onEvent: string, listener: any) {
48-
this.listener = listener;
49-
},
50-
removeEventListener() {
51-
return () => null;
52-
},
53-
postMessage(source: any, msg: any) {
54-
this.messages.push(msg);
55-
setTimeout(() => {
56-
if (typeof this.listener === 'function') {
57-
this.listener({ data: msg, origin: 'http://origin.test', source });
58-
}
59-
});
60-
},
61-
});
44+
): ImplPostMessage & { name: string; messages: any[] } => {
45+
let listener: (event: any) => void;
46+
return {
47+
name,
48+
messages: [],
49+
addEventListener(onEvent: string, _listener: typeof listener) {
50+
listener = _listener;
51+
},
52+
removeEventListener() {
53+
return () => null;
54+
},
55+
postMessage(source: any, msg: any) {
56+
this.messages.push(msg);
57+
setTimeout(() => {
58+
if (typeof listener === 'function') {
59+
listener({ data: msg, origin: 'http://origin.test', source });
60+
}
61+
});
62+
},
63+
};
64+
};
6265

6366
const getConnections = (): { walletWindow: ImplPostMessage; aeppWindow: ImplPostMessage } => {
6467
// @ts-expect-error workaround for tests

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"preserveConstEnums": true,
1919
"declaration": true,
2020
"downlevelIteration": true,
21+
"noImplicitThis": true,
2122
"strictPropertyInitialization": true,
2223
"strictNullChecks": true,
2324
"useUnknownInCatchVariables": true,

0 commit comments

Comments
 (0)