Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Ganache v7.0.0 - typings are broken #2134

Closed
gorbak25 opened this issue Jan 21, 2022 · 3 comments · Fixed by #2527
Closed

Ganache v7.0.0 - typings are broken #2134

gorbak25 opened this issue Jan 21, 2022 · 3 comments · Fixed by #2527
Assignees
Milestone

Comments

@gorbak25
Copy link

gorbak25 commented Jan 21, 2022

node_modules/ganache/dist/ganache.d.ts:16:39 - error TS2307: Cannot find module 'ipfs-core/src/components' or its corresponding type declarations.

16 import { ipfsCoreSrcComponents } from 'ipfs-core/src/components';
                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/ganache/dist/ganache.d.ts:18:24 - error TS2307: Cannot find module '@filecoin-shipyard/lotus-client-schema' or its corresponding type declarations.

18 import { Schema } from '@filecoin-shipyard/lotus-client-schema';
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/ganache/dist/ganache.d.ts:19:24 - error TS2307: Cannot find module 'seedrandom' or its corresponding type declarations.

19 import seedrandom from 'seedrandom';
                          ~~~~~~~~~~~~

node_modules/ganache/dist/ganache.d.ts:3704:75 - error TS2307: Cannot find module './types/subscriptions' or its corresponding type declarations.

3704     get provider(): FilecoinProvider_2<JsonRpcRequest<FilecoinApi, import("./types/subscriptions").SubscriptionMethod.ChannelClosed | "initialize" | "stop" | "Filecoin.Version" | "Filecoin.ID" | "Filecoin.ChainGetGenesis" | "Filecoin.ChainHead" | "Filecoin.ChainNotify" | "Filecoin.ChainGetTipSet" | "Filecoin.ChainGetTipSetByHeight" | "Filecoin.ChainGetBlock" | "Filecoin.ChainGetBlockMessages" | "Filecoin.ChainGetMessage" | "Filecoin.MpoolGetNonce" | "Filecoin.MpoolPush" | "Filecoin.MpoolBatchPush" | "Filecoin.MpoolPushMessage" | "Filecoin.MpoolBatchPushMessage" | "Filecoin.MpoolClear" | "Filecoin.MpoolPending" | "Filecoin.MpoolSelect" | "Filecoin.ActorAddress" | "Filecoin.StateListMiners" | "Filecoin.StateMinerPower" | "Filecoin.StateMinerInfo" | "Filecoin.WalletDefaultAddress" | "Filecoin.WalletSetDefault" | "Filecoin.WalletBalance" | "Filecoin.WalletNew" | "Filecoin.WalletList" | "Filecoin.WalletHas" | "Filecoin.WalletDelete" | "Filecoin.WalletExport" | "Filecoin.WalletImport" | "Filecoin.WalletSign" | "Filecoin.WalletSignMessage" | "Filecoin.WalletVerify" | "Filecoin.WalletValidateAddress" | "Filecoin.ClientStartDeal" | "Filecoin.ClientListDeals" | "Filecoin.ClientGetDealInfo" | "Filecoin.ClientGetDealStatus" | "Filecoin.ClientGetDealUpdates" | "Filecoin.ClientFindData" | "Filecoin.ClientHasLocal" | "Filecoin.ClientRetrieve" | "Ganache.MineTipset" | "Ganache.EnableMiner" | "Ganache.DisableMiner" | "Ganache.MinerEnabled" | "Ganache.MinerEnabledNotify" | "Ganache.GetDealById">>;
                                                                               ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/ganache/dist/ganache.d.ts:7101:163 - error TS2344: Type 'ExclusiveGroup<C, K>' does not satisfy the constraint 'unknown[]'.
  Type 'ExclusiveGroups<C>[ExclusiveGroupIndex<C>]' is not assignable to type 'unknown[]'.
    Type 'ExclusiveGroups<C>[number]' is not assignable to type 'unknown[]'.

7101 declare type ExclusiveGroupOptionName<C extends Base.Config, K extends ExclusiveGroupIndex<C> = ExclusiveGroupIndex<C>> = Extract<OptionName<C>, DeepTupleToUnion<ExclusiveGroup<C, K>>>;
                                                                                                                                                                       ~~~~~~~~~~~~~~~~~~~~

node_modules/ganache/dist/ganache.d.ts:7113:141 - error TS2344: Type 'G' does not satisfy the constraint 'unknown[]'.
  Type 'ExclusiveGroup<C, ExclusiveGroupIndex<C>>' is not assignable to type 'unknown[]'.
    Type 'ExclusiveGroups<C>[number]' is not assignable to type 'unknown[]'.

7113 declare type ExclusiveGroupOptionsByGroup<C extends Base.Config, G extends ExclusiveGroup<C>> = PairsToMapping<ExclusiveGroupOptionPairs<C, G>>;
                                                                                                                                                 ~

node_modules/ganache/dist/ganache.d.ts:10699:5 - error TS2416: Property 'hash' in type 'RuntimeTransaction' is not assignable to the same property in base type 'BaseTransaction'.
  Type 'Data | null' is not assignable to type 'Data'.
    Type 'null' is not assignable to type 'Data'.

10699     hash: Data | null;
          ~~~~


Found 7 errors.

Installing the missing dependencies or changing the typeroots doesn't help

@gorbak25
Copy link
Author

gorbak25 commented Jan 21, 2022

The latest version which correctly typechecks is 7.0.0-beta.1

@davidmurdoch
Copy link
Member

davidmurdoch commented Jan 21, 2022

Thanks, looks like a few things went wrong with the rollup here:

  1. filecoin-related 3rd party types weren't rolled up; we'll be moving the
  2. The packages abstract-leveldown, lru-cache, and seedrandom types were also omitted.

As a workaround you may be able to add "skipLibCheck": true to your tsconfig.json, though this is definitely not ideal, as it will also skip local *.d.ts type checking. You'll still see the all type help in your IDE with this setting enabled, but filecoin types may not be work.

I've added this as a priority 1 issue and slated it for a patch release.

@davidmurdoch
Copy link
Member

Related: #2125

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants