Skip to content

Commit

Permalink
chore: added noImplicitOverride option to config (#3384)
Browse files Browse the repository at this point in the history
* chore(packages): added noImplicitOverride option to config

* chore(packages): added missed modifiers in BN class

* chore(packages): added missed modifiers

* chore(packages): added missed modifiers

* chore(packages): fix changeset file

* Update .changeset/strange-starfishes-raise.md

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* Update packages/abi-coder/src/encoding/coders/EnumCoder.ts

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* Update packages/abi-coder/src/encoding/coders/StructCoder.ts

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* Update packages/abi-coder/src/encoding/coders/OptionCoder.ts

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* Update packages/abi-coder/src/encoding/coders/OptionCoder.ts

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>

* chore: added noImplicitOverride option to config

* Delete .changeset/strange-starfishes-raise.md

---------

Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>
  • Loading branch information
YaTut1901 and petertonysmith94 authored Nov 18, 2024
1 parent 537fdc2 commit c904a98
Show file tree
Hide file tree
Showing 34 changed files with 148 additions and 128 deletions.
11 changes: 11 additions & 0 deletions .changeset/large-points-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@fuel-ts/abi-typegen": patch
"@fuel-ts/abi-coder": patch
"@fuel-ts/account": patch
"@fuel-ts/address": patch
"@fuel-ts/program": patch
"@fuel-ts/script": patch
"@fuel-ts/math": patch
---

chore: added noImplicitOverride option to config
4 changes: 2 additions & 2 deletions apps/docs-snippets2/src/wallets/connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ metadata = {

class WalletConnector extends FuelConnector {
// #region fuel-connector-name
name: string = 'My Wallet Connector';
public override name: string = 'My Wallet Connector';
// #endregion fuel-connector-name

// #region fuel-connector-metadata
metadata = {
public override metadata = {
install: metadata.install,
image: metadata.image,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Fuel, FuelConnector } from 'fuels';

class WalletConnector extends FuelConnector {
name: string = 'My Wallet Connector';
public override name: string = 'My Wallet Connector';
}

const defaultConnectors = (_opts: {
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-coder/src/encoding/coders/EnumCoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class EnumCoder<TCoders extends Record<string, Coder>> extends Coder<
InputValueOf<TCoders>,
DecodedValueOf<TCoders>
> {
name: string;
override name: string;
coders: TCoders;
#caseIndexCoder: BigNumberCoder;
#encodedValueSize: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/abi-coder/src/encoding/coders/OptionCoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type SwayOption<T> = { None: [] } | { Some: T };
export type Option<T> = T | undefined;

export class OptionCoder<TCoders extends Record<string, Coder>> extends EnumCoder<TCoders> {
encode(value?: Option<unknown>): Uint8Array {
override encode(value?: Option<unknown>): Uint8Array {
const result = super.encode(this.toSwayOption(value) as unknown as InputValueOf<TCoders>);
return result;
}
Expand All @@ -19,7 +19,7 @@ export class OptionCoder<TCoders extends Record<string, Coder>> extends EnumCode
return { None: [] };
}

decode(data: Uint8Array, offset: number): [DecodedValueOf<TCoders>, number] {
override decode(data: Uint8Array, offset: number): [DecodedValueOf<TCoders>, number] {
const [decoded, newOffset] = super.decode(data, offset);
return [this.toOption(decoded) as DecodedValueOf<TCoders>, newOffset];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-coder/src/encoding/coders/StructCoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class StructCoder<TCoders extends Record<string, Coder>> extends Coder<
InputValueOf<TCoders>,
DecodedValueOf<TCoders>
> {
name: string;
override name: string;
coders: TCoders;
#hasNestedOption: boolean;

Expand Down
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/AssetIdType.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { B256Type } from './B256Type';

export class AssetIdType extends B256Type {
public static swayType = 'struct AssetId';
public static override swayType = 'struct AssetId';

public name = 'AssetId';
public override name = 'AssetId';

static MATCH_REGEX = /^struct AssetId$/m;
static override MATCH_REGEX = /^struct AssetId$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return AssetIdType.MATCH_REGEX.test(params.type);
}
}
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/B256Type.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { StrType } from './StrType';

export class B256Type extends StrType {
public static swayType = 'b256';
public static override swayType = 'b256';

public name = 'b256';
public override name = 'b256';

static MATCH_REGEX = /^b256$/m;
static override MATCH_REGEX = /^b256$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return B256Type.MATCH_REGEX.test(params.type);
}
}
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/B512Type.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { B256Type } from './B256Type';

export class B512Type extends B256Type {
public static swayType = 'struct B512';
public static override swayType = 'struct B512';

public name = 'b512';
public override name = 'b512';

static MATCH_REGEX = /^struct (std::b512::)?B512$/m;
static override MATCH_REGEX = /^struct (std::b512::)?B512$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return B512Type.MATCH_REGEX.test(params.type);
}
}
10 changes: 5 additions & 5 deletions packages/abi-typegen/src/abi/types/BytesType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import type { IType } from '../../types/interfaces/IType';
import { ArrayType } from './ArrayType';

export class BytesType extends ArrayType {
public static swayType = 'struct Bytes';
public static override swayType = 'struct Bytes';

public name = 'bytes';
public override name = 'bytes';

static MATCH_REGEX: RegExp = /^struct (std::bytes::)?Bytes/m;
static override MATCH_REGEX: RegExp = /^struct (std::bytes::)?Bytes/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return BytesType.MATCH_REGEX.test(params.type);
}

public parseComponentsAttributes(_params: { types: IType[] }) {
public override parseComponentsAttributes(_params: { types: IType[] }) {
const capitalizedName = 'Bytes';

this.attributes = {
Expand Down
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/RawUntypedPtr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { IType } from '../../types/interfaces/IType';
import { U64Type } from './U64Type';

export class RawUntypedPtr extends U64Type implements IType {
public static swayType = 'raw untyped ptr';
public static override swayType = 'raw untyped ptr';

public name = 'rawUntypedPtr';
public override name = 'rawUntypedPtr';

public static MATCH_REGEX: RegExp = /^raw untyped ptr$/m;
public static override MATCH_REGEX: RegExp = /^raw untyped ptr$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return RawUntypedPtr.MATCH_REGEX.test(params.type);
}
}
10 changes: 5 additions & 5 deletions packages/abi-typegen/src/abi/types/RawUntypedSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import type { IType } from '../../types/interfaces/IType';
import { ArrayType } from './ArrayType';

export class RawUntypedSlice extends ArrayType {
public static swayType = 'raw untyped slice';
public static override swayType = 'raw untyped slice';

public name = 'rawUntypedSlice';
public override name = 'rawUntypedSlice';

public static MATCH_REGEX: RegExp = /^raw untyped slice$/m;
public static override MATCH_REGEX: RegExp = /^raw untyped slice$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return RawUntypedSlice.MATCH_REGEX.test(params.type);
}

public parseComponentsAttributes(_params: { types: IType[] }) {
public override parseComponentsAttributes(_params: { types: IType[] }) {
const capitalizedName = 'RawSlice';

this.attributes = {
Expand Down
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/U16Type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { IType } from '../../types/interfaces/IType';
import { U8Type } from './U8Type';

export class U16Type extends U8Type implements IType {
public static swayType = 'u16';
public static override swayType = 'u16';

public name = 'u16';
public override name = 'u16';

public static MATCH_REGEX: RegExp = /^u16$/m;
public static override MATCH_REGEX: RegExp = /^u16$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return U16Type.MATCH_REGEX.test(params.type);
}
}
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/U256Type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { IType } from '../../types/interfaces/IType';
import { U64Type } from './U64Type';

export class U256Type extends U64Type implements IType {
public static swayType = 'u256';
public static override swayType = 'u256';

public name = 'u256';
public override name = 'u256';

public static MATCH_REGEX: RegExp = /^u256$/m;
public static override MATCH_REGEX: RegExp = /^u256$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return U256Type.MATCH_REGEX.test(params.type);
}
}
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/U32Type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { IType } from '../../types/interfaces/IType';
import { U8Type } from './U8Type';

export class U32Type extends U8Type implements IType {
public static swayType = 'u32';
public static override swayType = 'u32';

public name = 'u32';
public override name = 'u32';

public static MATCH_REGEX: RegExp = /^u32$/m;
public static override MATCH_REGEX: RegExp = /^u32$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return U32Type.MATCH_REGEX.test(params.type);
}
}
10 changes: 5 additions & 5 deletions packages/abi-typegen/src/abi/types/U64Type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { IType } from '../../types/interfaces/IType';
import { U8Type } from './U8Type';

export class U64Type extends U8Type implements IType {
public static swayType = 'u64';
public static override swayType = 'u64';

public name = 'u64';
public override name = 'u64';

public static MATCH_REGEX: RegExp = /^u64$/m;
public static override MATCH_REGEX: RegExp = /^u64$/m;

public parseComponentsAttributes(_params: { types: IType[] }) {
public override parseComponentsAttributes(_params: { types: IType[] }) {
this.attributes = {
inputLabel: `BigNumberish`,
outputLabel: `BN`,
Expand All @@ -18,7 +18,7 @@ export class U64Type extends U8Type implements IType {
return this.attributes;
}

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return U64Type.MATCH_REGEX.test(params.type);
}
}
10 changes: 5 additions & 5 deletions packages/abi-typegen/src/abi/types/VectorType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import type { IType } from '../../types/interfaces/IType';
import { ArrayType } from './ArrayType';

export class VectorType extends ArrayType {
public static swayType = 'struct Vec';
public static override swayType = 'struct Vec';

public name = 'vector';
public override name = 'vector';

static MATCH_REGEX: RegExp = /^struct (std::vec::)?Vec/m;
static override MATCH_REGEX: RegExp = /^struct (std::vec::)?Vec/m;
static IGNORE_REGEX: RegExp = /^struct (std::vec::)?RawVec$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
const isAMatch = VectorType.MATCH_REGEX.test(params.type);
const shouldBeIgnored = VectorType.IGNORE_REGEX.test(params.type);
return isAMatch && !shouldBeIgnored;
}

public parseComponentsAttributes(_params: { types: IType[] }) {
public override parseComponentsAttributes(_params: { types: IType[] }) {
this.attributes = {
inputLabel: `Vec`,
outputLabel: `Vec`,
Expand Down
2 changes: 1 addition & 1 deletion packages/account/src/connectors/fuel-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export abstract class FuelConnector extends EventEmitter implements Connector {
* @param eventName - The event name to listen
* @param listener - The listener function
*/
on<E extends FuelConnectorEvents['type'], D extends FuelEventArg<E>>(
override on<E extends FuelConnectorEvents['type'], D extends FuelEventArg<E>>(
eventName: E,
listener: (data: D) => void
): this {
Expand Down
12 changes: 8 additions & 4 deletions packages/account/src/predicate/predicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ export class Predicate<
* @param transactionRequestLike - The transaction request-like object.
* @returns A promise that resolves to the transaction response.
*/
sendTransaction(transactionRequestLike: TransactionRequestLike): Promise<TransactionResponse> {
override sendTransaction(
transactionRequestLike: TransactionRequestLike
): Promise<TransactionResponse> {
const transactionRequest = transactionRequestify(transactionRequestLike);

return super.sendTransaction(transactionRequest, { estimateTxDependencies: false });
Expand All @@ -129,7 +131,9 @@ export class Predicate<
* @param transactionRequestLike - The transaction request-like object.
* @returns A promise that resolves to the call result.
*/
simulateTransaction(transactionRequestLike: TransactionRequestLike): Promise<CallResult> {
override simulateTransaction(
transactionRequestLike: TransactionRequestLike
): Promise<CallResult> {
const transactionRequest = transactionRequestify(transactionRequestLike);
return super.simulateTransaction(transactionRequest, { estimateTxDependencies: false });
}
Expand Down Expand Up @@ -187,7 +191,7 @@ export class Predicate<
* @param excludedIds - IDs of resources to be excluded from the query.
* @returns A promise that resolves to an array of Resources.
*/
async getResourcesToSpend(
override async getResourcesToSpend(
quantities: CoinQuantityLike[] /** IDs of coins to exclude */,
excludedIds?: ExcludeResourcesOption
): Promise<Resource[]> {
Expand All @@ -209,7 +213,7 @@ export class Predicate<
* @param coins - An array of `FakeResources` objects representing the coins.
* @returns An array of `Resource` objects with generated properties.
*/
generateFakeResources(coins: FakeResources[]): Array<Resource> {
override generateFakeResources(coins: FakeResources[]): Array<Resource> {
return super.generateFakeResources(coins).map((coin) => ({
...coin,
predicate: hexlify(this.bytes),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class BlobTransactionRequest extends BaseTransactionRequest {
* @param gasCosts - gas costs passed from the chain.
* @returns metadata gas cost for the blob transaction.
*/
metadataGas(gasCosts: GasCosts): BN {
override metadataGas(gasCosts: GasCosts): BN {
return calculateMetadataGasForTxBlob({
gasCosts,
txBytesSize: this.byteSize(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class CreateTransactionRequest extends BaseTransactionRequest {
});
}

metadataGas(gasCosts: GasCosts): BN {
override metadataGas(gasCosts: GasCosts): BN {
return calculateMetadataGasForTxCreate({
contractBytesSize: bn(arrayify(this.witnesses[this.bytecodeWitnessIndex] || '0x').length),
gasCosts,
Expand Down
9 changes: 5 additions & 4 deletions packages/account/src/providers/transaction-request/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import type { AbstractAddress } from '@fuel-ts/interfaces';
* @hidden
*/
export class ChangeOutputCollisionError extends Error {
name = 'ChangeOutputCollisionError';
message = 'A ChangeOutput with the same "assetId" already exists for a different "to" address';
override name = 'ChangeOutputCollisionError';
override message =
'A ChangeOutput with the same "assetId" already exists for a different "to" address';
}

/**
* @hidden
*/
export class NoWitnessAtIndexError extends Error {
name = 'NoWitnessAtIndexError';
override name = 'NoWitnessAtIndexError';
constructor(public readonly index: number) {
super();
this.message = `Witness at index "${index}" was not found`;
Expand All @@ -24,7 +25,7 @@ export class NoWitnessAtIndexError extends Error {
* @hidden
*/
export class NoWitnessByOwnerError extends Error {
name = 'NoWitnessByOwnerError';
override name = 'NoWitnessByOwnerError';
constructor(public readonly owner: AbstractAddress) {
super();
this.message = `A witness for the given owner "${owner}" was not found`;
Expand Down
Loading

0 comments on commit c904a98

Please sign in to comment.