metaplex-foundation / js

A JavaScript SDK for interacting with Metaplex's programs
357 stars 182 forks source link

error TS6200: Definitions of the following identifiers conflict with those in another file #153

Closed C-o-d-e-C-o-w-b-o-y closed 2 years ago

C-o-d-e-C-o-w-b-o-y commented 2 years ago

Having trouble running tsc on the basic examples shown in in the README

Versions:

{
    "@metaplex-foundation/js": "^0.11.7",
    "@solana/web3.js": "^1.47.3",
}

Any ideas?

Error:

node_modules/@metaplex-foundation/mpl-candy-machine/node_modules/@solana/web3.js/lib/index.d.ts:2:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Struct, Enum, SOLANA_SCHEMA, MAX_SEED_LENGTH, PublicKeyInitData, PublicKeyData, PublicKey, Account, Blockhash, BPF_LOADER_DEPRECATED_PROGRAM_ID, EpochSchedule, NONCE_ACCOUNT_LENGTH, NonceAccount, Keypair, MessageHeader, CompiledInstruction, MessageArgs, Message, TransactionSignature, AccountMeta, TransactionInstructionCtorFields, SerializeConfig, TransactionInstruction, SignaturePubkeyPair, TransactionCtorFields, NonceInformation, Transaction, ClientSubscriptionId, TokenAccountsFilter, Context, SendOptions, ConfirmOptions, ConfirmedSignaturesForAddress2Options, SignaturesForAddressOptions, RpcResponseAndContext, Commitment, Finality, LargestAccountsFilter, GetLargestAccountsConfig, GetSupplyConfig, SignatureStatusConfig, ContactInfo, VoteAccountInfo, VoteAccountStatus, InflationGovernor, InflationReward, EpochInfo, LeaderSchedule, Version, SimulatedTransactionAccountInfo, SimulatedTransactionResponse, ParsedInnerInstruction, TokenBalance, ParsedConfirmedTransactionMeta, ParsedTransactionMeta, CompiledInnerInstruction, ConfirmedTransactionMeta, TransactionResponse, ConfirmedTransaction, PartiallyDecodedInstruction, ParsedMessageAccount, ParsedInstruction, ParsedMessage, ParsedTransaction, ParsedConfirmedTransaction, ParsedTransactionWithMeta, BlockResponse, ConfirmedBlock, BlockSignatures, BlockProduction, GetBlockProductionConfig, PerfSample, Supply, TokenAmount, TokenAccountBalancePair, AccountBalancePair, SlotUpdate, SlotInfo, ParsedAccountData, StakeActivationData, DataSlice, MemcmpFilter, DataSizeFilter, GetProgramAccountsFilter, GetProgramAccountsConfig, GetParsedProgramAccountsConfig, GetMultipleAccountsConfig, AccountInfo, KeyedAccountInfo, AccountChangeCallback, ProgramAccountChangeCallback, SlotChangeCallback, SlotUpdateCallback, SignatureResultCallback, SignatureStatusNotification, SignatureReceivedNotification, SignatureSubscriptionCallback, SignatureSubscriptionOptions, RootChangeCallback, Logs, LogsFilter, LogsCallback, SignatureResult, TransactionError, TransactionConfirmationStatus, SignatureStatus, ConfirmedSignatureInfo, HttpHeaders, FetchMiddleware, ConnectionConfig, Connection, BPF_LOADER_PROGRAM_ID, BpfLoader, ComputeBudgetInstruction, ComputeBudgetInstructionType, RequestHeapFrameParams, ComputeBudgetProgram, CreateEd25519InstructionWithPublicKeyParams, CreateEd25519InstructionWithPrivateKeyParams, Ed25519Program, Loader, STAKE_CONFIG_ID, Authorized, Lockup, CreateStakeAccountParams, CreateStakeAccountWithSeedParams, InitializeStakeParams, DelegateStakeParams, AuthorizeStakeParams, AuthorizeWithSeedStakeParams, SplitStakeParams, SplitStakeWithSeedParams, WithdrawStakeParams, DeactivateStakeParams, MergeStakeParams, StakeInstruction, StakeInstructionType, StakeAuthorizationType, StakeAuthorizationLayout, StakeProgram, CreateAccountParams, TransferParams, AssignParams, CreateAccountWithSeedParams, CreateNonceAccountParams, CreateNonceAccountWithSeedParams, InitializeNonceParams, AdvanceNonceParams, WithdrawNonceParams, AuthorizeNonceParams, AllocateParams, AllocateWithSeedParams, AssignWithSeedParams, TransferWithSeedParams, DecodedTransferInstruction, DecodedTransferWithSeedInstruction, SystemInstruction, SystemInstructionType, SystemProgram, CreateSecp256k1InstructionWithPublicKeyParams, CreateSecp256k1InstructionWithEthAddressParams, CreateSecp256k1InstructionWithPrivateKeyParams, Secp256k1Program, PACKET_DATA_SIZE, SIGNATURE_LENGTH_IN_BYTES, VALIDATOR_INFO_KEY, Info, ValidatorInfo, VOTE_PROGRAM_ID, Lockout, EpochCredits, AuthorizedVoter, PriorVoter, BlockTimestamp, VoteAccount, VoteInit, CreateVoteAccountParams, InitializeAccountParams, AuthorizeVoteParams, WithdrawFromVoteAccountParams, VoteInstruction, VoteInstructionType, VoteAuthorizationType, VoteAuthorizationLayout, VoteProgram, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, SendTransactionError, Cluster, LAMPORTS_PER_SOL

2 declare module '@solana/web3.js' {
  ~~~~~~~

  node_modules/@solana/web3.js/lib/index.d.ts:2:1
    2 declare module '@solana/web3.js' {
      ~~~~~~~
    Conflicts are in this file.

node_modules/@solana/web3.js/lib/index.d.ts:2:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Struct, Enum, SOLANA_SCHEMA, MAX_SEED_LENGTH, PublicKeyInitData, PublicKeyData, PublicKey, Account, Blockhash, BPF_LOADER_DEPRECATED_PROGRAM_ID, EpochSchedule, NONCE_ACCOUNT_LENGTH, NonceAccount, Keypair, MessageHeader, CompiledInstruction, MessageArgs, Message, TransactionSignature, AccountMeta, TransactionInstructionCtorFields, SerializeConfig, TransactionInstruction, SignaturePubkeyPair, TransactionCtorFields, NonceInformation, Transaction, ClientSubscriptionId, TokenAccountsFilter, Context, SendOptions, ConfirmOptions, ConfirmedSignaturesForAddress2Options, SignaturesForAddressOptions, RpcResponseAndContext, Commitment, Finality, LargestAccountsFilter, GetLargestAccountsConfig, GetSupplyConfig, SignatureStatusConfig, ContactInfo, VoteAccountInfo, VoteAccountStatus, InflationGovernor, InflationReward, EpochInfo, LeaderSchedule, Version, SimulatedTransactionAccountInfo, SimulatedTransactionResponse, ParsedInnerInstruction, TokenBalance, ParsedConfirmedTransactionMeta, ParsedTransactionMeta, CompiledInnerInstruction, ConfirmedTransactionMeta, TransactionResponse, ConfirmedTransaction, PartiallyDecodedInstruction, ParsedMessageAccount, ParsedInstruction, ParsedMessage, ParsedTransaction, ParsedConfirmedTransaction, ParsedTransactionWithMeta, BlockResponse, ConfirmedBlock, BlockSignatures, BlockProduction, GetBlockProductionConfig, PerfSample, Supply, TokenAmount, TokenAccountBalancePair, AccountBalancePair, SlotUpdate, SlotInfo, ParsedAccountData, StakeActivationData, DataSlice, MemcmpFilter, DataSizeFilter, GetProgramAccountsFilter, GetProgramAccountsConfig, GetParsedProgramAccountsConfig, GetMultipleAccountsConfig, AccountInfo, KeyedAccountInfo, AccountChangeCallback, ProgramAccountChangeCallback, SlotChangeCallback, SlotUpdateCallback, SignatureResultCallback, SignatureStatusNotification, SignatureReceivedNotification, SignatureSubscriptionCallback, SignatureSubscriptionOptions, RootChangeCallback, Logs, LogsFilter, LogsCallback, SignatureResult, TransactionError, TransactionConfirmationStatus, SignatureStatus, ConfirmedSignatureInfo, HttpHeaders, FetchMiddleware, ConnectionConfig, Connection, BPF_LOADER_PROGRAM_ID, BpfLoader, ComputeBudgetInstruction, ComputeBudgetInstructionType, RequestHeapFrameParams, ComputeBudgetProgram, CreateEd25519InstructionWithPublicKeyParams, CreateEd25519InstructionWithPrivateKeyParams, Ed25519Program, Loader, STAKE_CONFIG_ID, Authorized, Lockup, CreateStakeAccountParams, CreateStakeAccountWithSeedParams, InitializeStakeParams, DelegateStakeParams, AuthorizeStakeParams, AuthorizeWithSeedStakeParams, SplitStakeParams, SplitStakeWithSeedParams, WithdrawStakeParams, DeactivateStakeParams, MergeStakeParams, StakeInstruction, StakeInstructionType, StakeAuthorizationType, StakeAuthorizationLayout, StakeProgram, CreateAccountParams, TransferParams, AssignParams, CreateAccountWithSeedParams, CreateNonceAccountParams, CreateNonceAccountWithSeedParams, InitializeNonceParams, AdvanceNonceParams, WithdrawNonceParams, AuthorizeNonceParams, AllocateParams, AllocateWithSeedParams, AssignWithSeedParams, TransferWithSeedParams, DecodedTransferInstruction, DecodedTransferWithSeedInstruction, SystemInstruction, SystemInstructionType, SystemProgram, CreateSecp256k1InstructionWithPublicKeyParams, CreateSecp256k1InstructionWithEthAddressParams, CreateSecp256k1InstructionWithPrivateKeyParams, Secp256k1Program, PACKET_DATA_SIZE, SIGNATURE_LENGTH_IN_BYTES, VALIDATOR_INFO_KEY, Info, ValidatorInfo, VOTE_PROGRAM_ID, Lockout, EpochCredits, AuthorizedVoter, PriorVoter, BlockTimestamp, VoteAccount, VoteInit, CreateVoteAccountParams, InitializeAccountParams, AuthorizeVoteParams, WithdrawFromVoteAccountParams, VoteInstruction, VoteInstructionType, VoteAuthorizationType, VoteAuthorizationLayout, VoteProgram, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, SendTransactionError, Cluster, LAMPORTS_PER_SOL

2 declare module '@solana/web3.js' {
  ~~~~~~~

  node_modules/@metaplex-foundation/mpl-candy-machine/node_modules/@solana/web3.js/lib/index.d.ts:2:1
    2 declare module '@solana/web3.js' {
      ~~~~~~~
    Conflicts are in this file.

Found 2 errors in 2 files.

Errors  Files
     1  node_modules/@metaplex-foundation/mpl-candy-machine/node_modules/@solana/web3.js/lib/index.d.ts:2
     1  node_modules/@solana/web3.js/lib/index.d.ts:2
lorisleiva commented 2 years ago

Sadly, node_modules in nested dependencies are not de-duplicated and so TS may end up thinking they are different packages with conflicting types.

I'm hoping I can find a better way to handle this in the future but for now, the SDK fixes this by using "skipLibCheck": true on the tsconfig.json file. I feel confident this would fix your issue too.

lorisleiva commented 2 years ago

Hi there 👋

I'm going to close this due to inactivity but feel free to open a new issue with updated information if you need to.

Thank you for your understanding.