From f1c3b8e3aeb96f6efb7e512ac3ba689253004c9d Mon Sep 17 00:00:00 2001 From: 0xknwn <145777008+0xknwn@users.noreply.github.com> Date: Fri, 17 May 2024 16:14:09 +0200 Subject: [PATCH] fix: cannot infer ts2742 types from starknet-types@0.7 (#1098) the externalization of types in starknet-types prevent typescript from inferring a type that are not available in the project. To workaround this issue, this commit imports the SPEC type so that the inference can happen --- src/account/default.ts | 2 ++ src/utils/stark.ts | 2 ++ src/wallet/account.ts | 2 ++ src/wallet/connect.ts | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/account/default.ts b/src/account/default.ts index 0a43d0a8a..dc4813c67 100644 --- a/src/account/default.ts +++ b/src/account/default.ts @@ -1,3 +1,5 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import type { SPEC } from 'starknet-types-07'; import { UDC, ZERO } from '../constants'; import { Provider, ProviderInterface } from '../provider'; import { Signer, SignerInterface } from '../signer'; diff --git a/src/utils/stark.ts b/src/utils/stark.ts index 28e295d81..dc9a995a2 100644 --- a/src/utils/stark.ts +++ b/src/utils/stark.ts @@ -1,3 +1,5 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import type { SPEC } from 'starknet-types-07'; import { getStarkKey, utils } from '@scure/starknet'; import { gzip, ungzip } from 'pako'; diff --git a/src/wallet/account.ts b/src/wallet/account.ts index 82d4e3cf6..874bab45b 100644 --- a/src/wallet/account.ts +++ b/src/wallet/account.ts @@ -3,6 +3,8 @@ import { type AddStarknetChainParameters, type NetworkChangeEventHandler, type WatchAssetParameters, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + type SPEC, } from 'starknet-types-07'; import { Account, AccountInterface } from '../account'; diff --git a/src/wallet/connect.ts b/src/wallet/connect.ts index f519546ea..c9be27f49 100644 --- a/src/wallet/connect.ts +++ b/src/wallet/connect.ts @@ -8,6 +8,8 @@ import { type ChainId, type StarknetWindowObject, type TypedData, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + type SPEC, } from 'starknet-types-07'; /**