aave-utilities icon indicating copy to clipboard operation
aave-utilities copied to clipboard

Cannot find module './typechain/IWETHGateway' or its corresponding type declarations.

Open simeoni3 opened this issue 2 years ago • 6 comments

Question

Hello guys, I installed required dependencies in my Angular dApp as described in the README:

npm install --save-dev ethers reflect-metadata
npm install @aave/contract-helpers @aave/math-utils

I coded the following typescript function

import { UiIncentiveDataProvider } from '@aave/contract-helpers';

getReservesIncentivesDataHumanized() {

    const incentiveDataProviderContract = new UiIncentiveDataProvider({
        // UiIncentiveDataProviderV3: From AAVE V3 deployed contracts page
        uiIncentiveDataProviderAddress:  '0x270f51cf3F681010B46f5c4Ee2aD5120Db33026F',
        provider: this.provider,
        chainId: chainId
    });

    return incentiveDataProviderContract.getReservesIncentivesDataHumanized(
        {
           // PoolAddressesProvider: From AAVE V3 deployed contracts page
            lendingPoolAddressProvider: '0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb' 
        }
    );
}

However when I try to compile my application I get a bunch of errors reporting some missing dependencies:

Error: node_modules/@aave/contract-helpers/dist/cjs/baseDebtToken-contract/index.d.ts:5:32 - error TS2307: Cannot find module './typechain/IDebtTokenBase' or its corresponding type declarations.

Error: node_modules/@aave/contract-helpers/dist/cjs/erc20-contract/index.d.ts:4:32 - error TS2307: Cannot find module './typechain/IERC20Detailed' or its corresponding type declarations.

Error: node_modules/@aave/contract-helpers/dist/cjs/erc20-2612/index.d.ts:3:28 - error TS2307: Cannot find module './typechain/IERC202612' or its corresponding type declarations.

I tried to import UiIncentiveDataProvider also from other locations: import { UiIncentiveDataProvider } from '@aave/contract-helpers/dist/esm'; import { UiIncentiveDataProvider } from '@aave/contract-helpers/dist/cjs'; but I get the very same result.

Is there something wrong in my approach?

Thank you very much.

Andrea

simeoni3 avatar Apr 15 '22 07:04 simeoni3

I'm running into similar issues when I attempt to compile just importing of the contract-helper modules:

import {
  UiPoolDataProvider,
  UiIncentiveDataProvider,
  ChainId,
} from '@aave/contract-helpers';

tsc compile errors:

node_modules/@aave/contract-helpers/dist/esm/baseDebtToken-contract/index.d.ts:5:32 - error TS2307: Cannot find module './typechain/IDebtTokenBase' or its corresponding type declarations.

5 import { IDebtTokenBase } from './typechain/IDebtTokenBase';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/erc20-2612/index.d.ts:3:28 - error TS2307: Cannot find module './typechain/IERC202612' or its corresponding type declarations.

3 import { IERC202612 } from './typechain/IERC202612';
                             ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/erc20-contract/index.d.ts:4:32 - error TS2307: Cannot find module './typechain/IERC20Detailed' or its corresponding type declarations.

4 import { IERC20Detailed } from './typechain/IERC20Detailed';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/faucet-contract/index.d.ts:4:25 - error TS2307: Cannot find module './typechain/IFaucet' or its corresponding type declarations.

4 import { IFaucet } from './typechain/IFaucet';
                          ~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/governance-contract/index.d.ts:4:35 - error TS2307: Cannot find module './typechain/IAaveGovernanceV2' or its corresponding type declarations.

4 import { IAaveGovernanceV2 } from './typechain/IAaveGovernanceV2';
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/governance-power-delegation-contract/index.d.ts:4:49 - error TS2307: Cannot find module './typechain/IGovernancePowerDelegationToken' or its corresponding type declarations.

4 import { IGovernancePowerDelegationToken } from './typechain/IGovernancePowerDelegationToken';
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/incentive-controller-v2/index.d.ts:4:45 - error TS2307: Cannot find module './typechain/IAaveIncentivesControllerV2' or its corresponding type declarations.

4 import { IAaveIncentivesControllerV2 } from './typechain/IAaveIncentivesControllerV2';
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/incentive-controller/index.d.ts:4:43 - error TS2307: Cannot find module './typechain/IAaveIncentivesController' or its corresponding type declarations.

4 import { IAaveIncentivesController } from './typechain/IAaveIncentivesController';
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/lendingPool-contract/index.d.ts:11:30 - error TS2307: Cannot find module './typechain/ILendingPool' or its corresponding type declarations.

11 import { ILendingPool } from './typechain/ILendingPool';
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/paraswap-liquiditySwapAdapter-contract/index.d.ts:4:47 - error TS2307: Cannot find module './typechain/IParaSwapLiquiditySwapAdapter' or its corresponding type declarations.

4 import { IParaSwapLiquiditySwapAdapter } from './typechain/IParaSwapLiquiditySwapAdapter';
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/paraswap-repayWithCollateralAdapter-contract/index.d.ts:4:38 - error TS2307: Cannot find module './typechain/ParaSwapRepayAdapter' or its corresponding type declarations.

4 import { ParaSwapRepayAdapter } from './typechain/ParaSwapRepayAdapter';
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/repayWithCollateralAdapter-contract/index.d.ts:4:38 - error TS2307: Cannot find module './typechain/IRepayWithCollateral' or its corresponding type declarations.

4 import { IRepayWithCollateral } from './typechain/IRepayWithCollateral';
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/staking-contract/index.d.ts:6:36 - error TS2307: Cannot find module './typechain/IAaveStakingHelper' or its corresponding type declarations.

6 import { IAaveStakingHelper } from './typechain/IAaveStakingHelper';
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/staking-contract/index.d.ts:7:30 - error TS2307: Cannot find module './typechain/IStakedToken' or its corresponding type declarations.

7 import { IStakedToken } from './typechain/IStakedToken';
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/synthetix-contract/index.d.ts:3:28 - error TS2307: Cannot find module './typechain/ISynthetix' or its corresponding type declarations.

3 import { ISynthetix } from './typechain/ISynthetix';
                             ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-pool-contract/index.d.ts:12:23 - error TS2307: Cannot find module './typechain/IPool' or its corresponding type declarations.

12 import { IPool } from './typechain/IPool';
                         ~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-pool-rollups/index.d.ts:5:25 - error TS2307: Cannot find module './typechain/IL2Pool' or its corresponding type declarations.

5 import { IL2Pool } from './typechain/IL2Pool';
                          ~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-pool-rollups/index.d.ts:6:27 - error TS2307: Cannot find module './typechain/L2Encoder' or its corresponding type declarations.

6 import { L2Encoder } from './typechain/L2Encoder';
                            ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-UiIncentiveDataProvider-contract/index.d.ts:5:44 - error TS2307: Cannot find module './typechain/IUiIncentiveDataProviderV3' or its corresponding type declarations.

5 import { IUiIncentiveDataProviderV3 } from './typechain/IUiIncentiveDataProviderV3';
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/wethgateway-contract/index.d.ts:6:30 - error TS2307: Cannot find module './typechain/IWETHGateway' or its corresponding type declarations.

6 import { IWETHGateway } from './typechain/IWETHGateway';
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~`

Any pointers would be appreciated!

peterfisher avatar Jun 25 '22 03:06 peterfisher

+1 on this

malsamax avatar Jun 30 '22 21:06 malsamax

Hey @simeoni3 @peterfisher - just for context, can you provide what version of Angular your dapp is using? Also, can you provide what version of TypeScript, if any, you are running as well? Thanks!

drewcook avatar Jul 26 '22 16:07 drewcook

+1 on this. My typescript version is 4.1.3 I am using this utility from a nodejs backend application. Do we have any workaround to get this running?

tsc compile errors:

node_modules/@aave/contract-helpers/dist/esm/baseDebtToken-contract/index.d.ts:5:32 - error TS2307: Cannot find module './typechain/IDebtTokenBase' or its corresponding type declarations.

5 import { IDebtTokenBase } from './typechain/IDebtTokenBase';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/erc20-2612/index.d.ts:3:28 - error TS2307: Cannot find module './typechain/IERC202612' or its corresponding type declarations.

3 import { IERC202612 } from './typechain/IERC202612';
                             ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/erc20-contract/index.d.ts:4:32 - error TS2307: Cannot find module './typechain/IERC20Detailed' or its corresponding type declarations.

4 import { IERC20Detailed } from './typechain/IERC20Detailed';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/faucet-contract/index.d.ts:4:25 - error TS2307: Cannot find module './typechain/IFaucet' or its corresponding type declarations.

4 import { IFaucet } from './typechain/IFaucet';
                          ~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/governance-contract/index.d.ts:4:35 - error TS2307: Cannot find module './typechain/IAaveGovernanceV2' or its corresponding type declarations.

4 import { IAaveGovernanceV2 } from './typechain/IAaveGovernanceV2';
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/governance-power-delegation-contract/index.d.ts:4:49 - error TS2307: Cannot find module './typechain/IGovernancePowerDelegationToken' or its corresponding type declarations.

4 import { IGovernancePowerDelegationToken } from './typechain/IGovernancePowerDelegationToken';
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/incentive-controller-v2/index.d.ts:4:45 - error TS2307: Cannot find module './typechain/IAaveIncentivesControllerV2' or its corresponding type declarations.

4 import { IAaveIncentivesControllerV2 } from './typechain/IAaveIncentivesControllerV2';
                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/incentive-controller/index.d.ts:4:43 - error TS2307: Cannot find module './typechain/IAaveIncentivesController' or its corresponding type declarations.

4 import { IAaveIncentivesController } from './typechain/IAaveIncentivesController';
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/lendingPool-contract/index.d.ts:11:30 - error TS2307: Cannot find module './typechain/ILendingPool' or its corresponding type declarations.

11 import { ILendingPool } from './typechain/ILendingPool';
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/paraswap-liquiditySwapAdapter-contract/index.d.ts:4:47 - error TS2307: Cannot find module './typechain/IParaSwapLiquiditySwapAdapter' or its corresponding type declarations.

4 import { IParaSwapLiquiditySwapAdapter } from './typechain/IParaSwapLiquiditySwapAdapter';
                                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/paraswap-repayWithCollateralAdapter-contract/index.d.ts:4:38 - error TS2307: Cannot find module './typechain/ParaSwapRepayAdapter' or its corresponding type declarations.

4 import { ParaSwapRepayAdapter } from './typechain/ParaSwapRepayAdapter';
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/repayWithCollateralAdapter-contract/index.d.ts:4:38 - error TS2307: Cannot find module './typechain/IRepayWithCollateral' or its corresponding type declarations.

4 import { IRepayWithCollateral } from './typechain/IRepayWithCollateral';
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/staking-contract/index.d.ts:6:36 - error TS2307: Cannot find module './typechain/IAaveStakingHelper' or its corresponding type declarations.

6 import { IAaveStakingHelper } from './typechain/IAaveStakingHelper';
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/staking-contract/index.d.ts:7:30 - error TS2307: Cannot find module './typechain/IStakedToken' or its corresponding type declarations.

7 import { IStakedToken } from './typechain/IStakedToken';
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/synthetix-contract/index.d.ts:3:28 - error TS2307: Cannot find module './typechain/ISynthetix' or its corresponding type declarations.

3 import { ISynthetix } from './typechain/ISynthetix';
                             ~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-pool-contract/index.d.ts:12:23 - error TS2307: Cannot find module './typechain/IPool' or its corresponding type declarations.

12 import { IPool } from './typechain/IPool';
                         ~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-pool-rollups/index.d.ts:5:25 - error TS2307: Cannot find module './typechain/IL2Pool' or its corresponding type declarations.

5 import { IL2Pool } from './typechain/IL2Pool';
                          ~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-pool-rollups/index.d.ts:6:27 - error TS2307: Cannot find module './typechain/L2Encoder' or its corresponding type declarations.

6 import { L2Encoder } from './typechain/L2Encoder';
                            ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/v3-UiIncentiveDataProvider-contract/index.d.ts:5:44 - error TS2307: Cannot find module './typechain/IUiIncentiveDataProviderV3' or its corresponding type declarations.

5 import { IUiIncentiveDataProviderV3 } from './typechain/IUiIncentiveDataProviderV3';
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@aave/contract-helpers/dist/esm/wethgateway-contract/index.d.ts:6:30 - error TS2307: Cannot find module './typechain/IWETHGateway' or its corresponding type declarations.

6 import { IWETHGateway } from './typechain/IWETHGateway';
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 20 errors.

bravura-quark avatar Nov 12 '22 03:11 bravura-quark

@simeoni3 @bravura-quark @peterfisher @malsamax Hi there! I've found a fix, that we've all missed — it's tsconfig configuration issue.

To fix this, add this to your tsconfig.json: "skipLibCheck": true

Learn more about this option here: https://www.typescriptlang.org/tsconfig#skipLibCheck

It worked out fine, and I hope that helps you guys too

Cheers

aintnomoreloyalty avatar Oct 03 '23 17:10 aintnomoreloyalty

That would make sense! https://github.com/aave/aave-utilities/blob/master/tsconfig.json#L21C5-L21C26

drewcook avatar Oct 03 '23 17:10 drewcook