Skip to content

Commit bc198e2

Browse files
authored
Use private for private members in classes instead of # (#2374)
1 parent 73e34c0 commit bc198e2

File tree

30 files changed

+347
-346
lines changed

30 files changed

+347
-346
lines changed

.changeset/tiny-forks-help.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@thirdweb-dev/wallets": patch
3+
"@thirdweb-dev/crypto": patch
4+
"thirdweb": patch
5+
"@thirdweb-dev/pay": patch
6+
"@thirdweb-dev/sdk": patch
7+
---
8+
9+
Use `private foo` instead of `#foo` for making the members private in classes

packages/cli/src/core/helpers/logger.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,39 @@ function shouldLog(minLevel: LogLevel, currentLevel: LogLevel): boolean {
1212
}
1313

1414
class BasicLogger {
15-
#minLevel: LogLevel = "info";
15+
private _minLevel: LogLevel = "info";
1616
constructor(params?: BasicLoggerConstructorParams) {
1717
if (params?.minLevel) {
18-
this.#minLevel = params.minLevel;
18+
this._minLevel = params.minLevel;
1919
}
2020
}
2121

2222
setSettings(params: BasicLoggerConstructorParams) {
2323
if (params.minLevel) {
24-
this.#minLevel = params.minLevel;
24+
this._minLevel = params.minLevel;
2525
}
2626
}
2727

2828
debug(...args: any[]) {
29-
if (shouldLog(this.#minLevel, "debug")) {
29+
if (shouldLog(this._minLevel, "debug")) {
3030
console.info(...args);
3131
}
3232
}
3333

3434
info(...args: any[]) {
35-
if (shouldLog(this.#minLevel, "info")) {
35+
if (shouldLog(this._minLevel, "info")) {
3636
console.info(...args);
3737
}
3838
}
3939

4040
warn(...args: any[]) {
41-
if (shouldLog(this.#minLevel, "warn")) {
41+
if (shouldLog(this._minLevel, "warn")) {
4242
console.warn(...args);
4343
}
4444
}
4545

4646
error(...args: any[]) {
47-
if (shouldLog(this.#minLevel, "error")) {
47+
if (shouldLog(this._minLevel, "error")) {
4848
console.error(...args);
4949
}
5050
}

packages/crypto/src/utils/cache.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
class TextProcessorCache {
2-
#encoder: TextEncoder | undefined;
3-
#decoder: TextDecoder | undefined;
2+
private _encoder: TextEncoder | undefined;
3+
private _decoder: TextDecoder | undefined;
44

55
get encoder(): TextEncoder {
6-
if (!this.#encoder) {
7-
this.#encoder = new TextEncoder();
6+
if (!this._encoder) {
7+
this._encoder = new TextEncoder();
88
}
9-
return this.#encoder;
9+
return this._encoder;
1010
}
1111

1212
get decoder(): TextDecoder {
13-
if (!this.#decoder) {
14-
this.#decoder = new TextDecoder();
13+
if (!this._decoder) {
14+
this._decoder = new TextDecoder();
1515
}
16-
return this.#decoder;
16+
return this._decoder;
1717
}
1818
}
1919

packages/pay/src/integrations/coinbase/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export type FundWalletOptions = {
1616
};
1717

1818
export class CoinbasePayIntegration {
19-
#appId: string;
19+
private _appId: string;
2020
constructor(options: CoinbasePayOptions) {
21-
this.#appId = options.appId;
21+
this._appId = options.appId;
2222
}
2323

2424
async fundWallet(opts: FundWalletOptions): Promise<void> {
@@ -27,7 +27,7 @@ export class CoinbasePayIntegration {
2727
return new Promise((res, rej) => {
2828
initOnRamp(
2929
{
30-
appId: this.#appId,
30+
appId: this._appId,
3131
widgetParameters: {
3232
destinationWallets: [
3333
{

packages/sdk/src/evm/common/error.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,9 @@ export type TransactionErrorInfo = {
284284
* @public
285285
*/
286286
export class TransactionError extends Error {
287-
#reason: string;
288-
#info: TransactionErrorInfo;
289-
#raw: any;
287+
private _reason: string;
288+
private _info: TransactionErrorInfo;
289+
private _raw: any;
290290

291291
constructor(info: TransactionErrorInfo, raw: any) {
292292
let errorMessage = `\n\n\n╔═══════════════════╗\n║ TRANSACTION ERROR ║\n╚═══════════════════╝\n\n`;
@@ -363,22 +363,22 @@ export class TransactionError extends Error {
363363

364364
super(errorMessage);
365365

366-
this.#reason = info.reason;
367-
this.#info = info;
368-
this.#raw = raw;
366+
this._reason = info.reason;
367+
this._info = info;
368+
this._raw = raw;
369369
}
370370

371371
// Keep reason here for backwards compatibility
372372
get reason(): string {
373-
return this.#reason;
373+
return this._reason;
374374
}
375375

376376
get raw(): any {
377-
return this.#raw;
377+
return this._raw;
378378
}
379379

380380
get info(): TransactionErrorInfo {
381-
return this.#info;
381+
return this._info;
382382
}
383383
}
384384

0 commit comments

Comments
 (0)